我正在使用此代码以编程方式切换视图控制器。当我构建并运行时,我收到此错误:@interface
没有可见的ViewController
声明选择器presentModalViewController:animated:completion:
代码:
[self presentModalViewController:pSearchViewController animated:YES completion:nil];
如果我摆脱完成:nil然后我得到警告presentModalViewController:animated
已被弃用:首先在iOS 6.0中弃用。我该怎么办?
答案 0 :(得分:3)
问题是presentmodalviewcontroller:
已弃用。请改用presentViewController:animated:completion:
。你的代码:
[self presentViewController:pSearchViewController animated:YES completion:nil];
答案 1 :(得分:-1)
-(void)alertview:(UIAlertView *)alertview clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex==1){
UIViewController *newview = [[UIViewController alloc]init];
[self presentedViewController:newview animated:YES completion:nil];
}
}