4

我对此很陌生,所以请耐心等待。我的代码中有 2 个错误需要修复。在这两种情况下,我的实例方法都没有找到:

-(IBAction)goFlipSide {
    NSLog(@"goFlipSide has been called:");
    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideViewController" bundle:nil];

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentViewController:controller animated:YES];

    [controller release];
}

- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
    [self dismissViewControllerAnimated:YES];

    //This method gets fired when the user clicks done on the modal FlipsideViewController.  This is different
    //than the viewWillAppear.
    self.navigationController.navigationBarHidden = TRUE;
    /*
    if (self.goViewSuccess == TRUE) {
        //if the goViewSuccess boolean is set to YES - then we can load the load the goViewController
        NSLog(@"goViewSuccess is YES");
        [self loadGoViewController];
    }
    */
}

两个未找到的实例方法是:presentViewController:dismissViewControllerAnimated:

4

2 回答 2

4

什么课self?这些方法只能在UIViewController. 完整的选择器是:

  • presentViewController:animated:completion:
  • dismissViewControllerAnimated:completion:

尝试添加完成块参数。

于 2013-04-19T01:56:32.920 回答
0

代码应该是这样的

[self dismissViewControllerAnimated:YES completion:nil];

或者如果你在完成后想要一些东西,

[self dismissViewControllerAnimated:YES completion:^{
//do stuff
}];

而对于另一个

[self presentViewController:controller animated:YES completion:nil];
于 2013-04-19T01:57:00.370 回答