Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 对于';没有可见的@界面;ViewController';声明选择器';presentModalViewController:动画:完成:';_Ios_Objective C - Fatal编程技术网

Ios 对于';没有可见的@界面;ViewController';声明选择器';presentModalViewController:动画:完成:';

Ios 对于';没有可见的@界面;ViewController';声明选择器';presentModalViewController:动画:完成:';,ios,objective-c,Ios,Objective C,我使用这段代码以编程方式切换视图控制器。当我构建并运行时,会出现以下错误:ViewController的@界面不可见声明选择器presentModalViewController:animated:completion: 代码: 如果我去掉completion:nil,那么我会得到警告presentModalViewController:animated已弃用:首次在iOS 6.0中弃用。我该怎么办?问题是presentmodalviewcontroller:已弃用。改用presentViewC

我使用这段代码以编程方式切换视图控制器。当我构建并运行时,会出现以下错误:
ViewController的
@界面不可见
声明选择器
presentModalViewController:animated:completion:

代码:


如果我去掉completion:nil,那么我会得到警告
presentModalViewController:animated
已弃用:首次在iOS 6.0中弃用。我该怎么办?

问题是
presentmodalviewcontroller:
已弃用。改用
presentViewController:animated:completion:
。您的代码:

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

[self.navigationController presentViewController:pSearchViewController动画:是完成:无];
[self presentViewController:pSearchViewController animated:YES completion:nil];
-(void)alertview:(UIAlertView *)alertview clickedButtonAtIndex:(NSInteger)buttonIndex{

     if (buttonIndex==1){
         UIViewController *newview = [[UIViewController alloc]init];
         [self presentedViewController:newview animated:YES completion:nil];
     }

}