2012-04-09 1 views
0

내가 물어보기로 결정하기 전에 이것에 관한 많은 문서를 읽었습니다. 내 응용 프로그램에 navigationController가 있습니다. 사용자가 내 앱에 처음으로 들어가면ModalViewControllerAnimated를 dismiss하는 방법 : 예

RegViewController *opr = [[RegViewController alloc] init]; 
self.regController = opr; 
[self.navigationController presentModalViewController:self.regController animated:NO]; 
[opr release]; 

그리고 잘 작동합니다. 내가 RegViewController에서 확인 버튼을 클릭하면하지만이 방법

-(IBAction)btn_regPressed:(id)sender 
{ 
    NSLog(@"start to dissmis modal"); 
[self.navigationController dismissModalViewControllerAnimated:YES]; 
//[self.navigationController.parentViewController dismissModalViewControllerAnimated:YES]; 
} 

에게 전화하지만이 코드는 누군가가 thios 문제를 제발 도와 드릴까요 dismissModalViewController 싶지 않습니다. 당신의 RegViewController에 감사

답변

0

,과 같이 자기를 해고하려고 :

-(IBAction)btn_regPressed:(id)sender 
{ 
    NSLog(@"start to dissmis modal"); 
    [self dismissModalViewControllerAnimated:YES]; 
} 
+0

감사합니다 !!!! 그것은 작동합니다! 나는 self.navigationController하지만 자기 작품을해야한다는 것을 읽었습니다! 다시 감사합니다 –

1

시도합니다 (있는 navigationController 제거)에 전화를 변경하려면 :

[self presentModalViewController:self.regController animated:NO]; 

하고 단추를합니다 (있는 navigationController을 제거) :

[self dismissModalViewControllerAnimated:YES]; 

귀하의 navigationController에게 귀하의 m odal,하지만 당신의 viewcontroller 그것을해야합니다. 탐색 컨트롤러는 탐색 (이동 및 되돌리기) 목적으로 사용됩니다. 아마도 navigationController는 nil입니다.