2010-04-07 137 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. 确保文件所有者的视图插口已正确连接到其视图。