2010-04-07 41 views
0

我有3個不同的xib。我可以回去查看圖1和圖2用下面的代碼之間來回...iPhone UINavigation Controller問題?

本規範帶來了第二種觀點...

-(IBAction)startButtonClicked:(id)sender{ 

    self.gamePlayViewController = [[GamePlayViewController alloc] initWithNibName:@"GamePlayViewController" bundle:nil]; 
    [self.navigationController pushViewController:gamePlayViewController animated:YES]; 
    [GamePlayViewController release]; 


} 

本準則第二視圖下執行而讓我回到第一個視圖...

- (IBAction爲)backButtonClicked {

[self.navigationController popViewControllerAnimated:YES]; 

}

現在,當我嘗試執行此代碼(在第二個視圖中)以進入第三個視圖時...我得到SIGABRT和應用程序崩潰......爲什麼它會爲第一個視圖啓動第二個視圖,但不是爲了提出第三種觀點的第二種觀點?

- (IBAction爲)新思維{

self.thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; 
     [self.navigationController pushViewController:thirdViewController animated:YES]; 
     [thirdViewController release]; 

} 

回答

0

有可能在ThirdViewController.xib某些物體或出口,你已經忘記了配置或配置錯誤。比較和對比ThirdViewController.xib和GamePlayViewController.xib,密切關注你如何配置ThirdViewController.xib的類名和插座。特別是:

  1. 確保您的文件所有者已正確設置爲ThirdViewController。
  2. 確保文件所有者的視圖插口已正確連接到其視圖。
相關問題