我有这个自定义后退按钮:
- (IBAction)backToMenu:(id)sender {
[self.presentingViewController dismissModalViewControllerAnimated:YES];
}
在 iOS 6 模拟器中测试我的应用程序说dismissModalViewControllerAnimated 已被弃用,我必须改用dismissViewControllerAnimated,所以,我如何使用iOS 6 代码并回退到iOS 5
我试过这个:
if([self respondsToSelector:@selector(presentingViewController:animated:completion:)])
[self.presentingViewController dismissViewControllerAnimated:(YES) completion:nil];
else if([self respondsToSelector:@selector(presentingViewController:animated:)])
[self.presentingViewController dismissModalViewControllerAnimated:YES];
else
NSLog(@"Oooops, what system is this ?!!! - should never see this !");
但是没有结果,我看到 NSLog 并且没有视图被驳回,有什么提示吗?
先感谢您。