2013-07-28 4 views
3

이 코드를 사용하여 프로그래밍 방식으로보기 컨트롤러를 전환합니다. 내가 구축하고 실행하는 경우,이 오류가 발생합니다 : ViewController에 대한 눈에 띄는 @interface 셀렉터를 선언하지 presentModalViewController:animated:completion:'ViewController'의 표시되지 않는 @interface는 selector 'presentModalViewController : animated : completion :'을 선언합니다.

코드 :

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

나는 완료를 제거하는 경우 : 전무 그때 내가 경고 presentModalViewController:animated이되지 않습니다 얻을 : iOS 6.0에서는 처음 사용되지 않습니다. 나는 무엇을해야합니까?

+2

[self.navigationController presentViewController : pSearchViewController 애니메이션 : YES 완료 : 닐]; –

답변

3

문제는 presentmodalviewcontroller:입니다. 대신 presentViewController:animated:completion:을 사용하십시오. 코드 :

[self presentViewController:pSearchViewController animated:YES completion:nil]; 
-1
-(void)alertview:(UIAlertView *)alertview clickedButtonAtIndex:(NSInteger)buttonIndex{ 

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

} 
관련 문제