2009-02-26 12 views
0

私はObjective Cで新しいです。私はiPhoneアプリを構築しようとしています。私はいくつかのNIBファイルを作成している、と私はオブジェクトを作成し、このコードを使用することにより、他のNIBファイルに行っている:同じページにどのように戻ってくることができますか?

scoreViewController *sviewController = [[scoreViewController alloc] initWithNibName:@"scoreViewController" bundle:nil]; 
self.scoreView = sviewController; 
[sviewController release]; 
// Setup the animation 
[self.navigationController pushViewController:self.scoreView animated:YES]; 

今、私は同じページに戻って来てほしいです。この場合、私は同じ作業をしましたが、前のページヘッダーファイル名を追加すると機能しません。

mainViewController *mainviewController = [[mainViewController alloc] initWithNibName:@"mainViewController" bundle:nil]; 
self.mcoreView = mainviewController; 
[mainviewController release]; 
// Setup the animation 
[self.navigationController pushViewController:self.mcoreView animated:YES]; 

あなたのコメントを投稿していただければ幸いです。

答えて

2

私はあなたが何を求めているのかはっきりしていませんが、2番目のコントローラから最初のものに戻ってみたいと思います。あなたがここでやっていることは、最初のコントローラの2番目のインスタンスをインスタンス化しているので(今は3つのコントローラがあります)、それをスタックにプッシュします。私がしていると仮定すると、この正しい、そして、あなたが戻って最初のコントローラサードを追加していない、スタックから第二のコントローラをポップする必要があるに移動する場合:

//mainViewController *mainviewController = [[mainViewController alloc] initWithNibName:@"mainViewController" bundle:nil]; 
//self.mcoreView = mainviewController; 
//[mainviewController release]; 

// Setup the animation 
[self.navigationController popViewControllerAnimated:YES]; 
+0

感謝、友人。それは仕事をしました。 –

関連する問題