2012-04-09 4 views
0

私は尋ねる前に、これに関する多くのドキュメントを読みました。 私はアプリケーションでnavigationControllerを持っています。ユーザーが初めてアプリケーションに入るときは、これを行う。ModalViewControllerAnimatedを解除する方法:はい

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

これはうまく動作する。私はRegViewControllerで[OK]ボタンをクリックすると、しかし、私はこの方法

-(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はゼロです。