[英]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.