简体   繁体   English

实例方法'-presentViewController:animated'未找到

[英]Instance method '-presentViewController:animated' not found

I'm fairly new to this, so bear with me. 我对此很新,所以请耐心等待。 I have 2 errors left to fix in my code. 我的代码中还有2个错误要修复。 In both cases my instance methods are not found: 在这两种情况下都找不到我的实例方法:

-(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];
    }
    */
}

Both instance methods not found are: presentViewController: and dismissViewControllerAnimated: . 找不到两个实例方法: presentViewController:dismissViewControllerAnimated: .

What class is self ? 什么课是self Those methods are only found on UIViewController . 这些方法只能在UIViewController找到。 The full selectors are: 完整的选择器是:

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

Try adding the completion block argument. 尝试添加完成块参数。

The code is supposed to be this 代码应该是这样的

[self dismissViewControllerAnimated:YES completion:nil];

or if you want something when its done, 或者如果你想完成它的话,

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

And for the other one 对于另一个

[self presentViewController:controller animated:YES completion:nil];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PresentViewController:动画无法在iPad上显示 - PresentViewController: animated not displaying on iPad presentViewController:animated:completion:失败 - presentViewController:animated:completion: fails presentViewController:animated:completion:总是导致所显示视图控制器的两个实例,这是一个错误吗? - presentViewController:animated:completion: always results in two instance of the presented view controller, is it a bug? presentViewController不适用于animated:NO - presentViewController won't work with animated:NO presentViewController 的回调方法 - Callback method for presentViewController presentViewController:animated:completion上的EXC_BAD_ACCESS - EXC_BAD_ACCESS on presentViewController:animated:completion presentViewController:animated:completion:导致我的程序崩溃 - presentViewController:animated:completion: causes my program to crash 链关闭dismissViewControllerAnimated:completion和presentViewController:animated时出错 - Error when chain dismissViewControllerAnimated:completion and presentViewController:animated UIViewController presentViewController:animated:completion - 需要4到6秒才能启动 - UIViewController presentViewController:animated:completion - taking 4 to 6 seconds to launch presentViewController:animated:completion中状态栏的影响 - Status bar influence in presentViewController:animated:completion
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM