I have 3 different xib's. I am able to go back and forth between view 1 and vi开发者_StackOverflowew 2 with the following code...
This Code brings up the second view...
-(IBAction)startButtonClicked:(id)sender{
self.gamePlayViewController = [[GamePlayViewController alloc] initWithNibName:@"GamePlayViewController" bundle:nil];
[self.navigationController pushViewController:gamePlayViewController animated:YES];
[GamePlayViewController release];
}
This Code is executed in the second view and brings me back to the first view...
-(IBAction)backButtonClicked{
[self.navigationController popViewControllerAnimated:YES];
}
Now when I try to execute this code (in the second view) to get to the third view...I get SIGABRT and the app crashes...why does it work for the first view bringing up the second view, but not for the second view bringing up the 3rd view?
-(IBAction)nextView{
self.thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
[self.navigationController pushViewController:thirdViewController animated:YES];
[thirdViewController release];
}
There's probably some object or outlet in ThirdViewController.xib that you've forgotten to configure or misconfigured. Compare and contrast ThirdViewController.xib and GamePlayViewController.xib, paying close attention to how you've configured ThirdViewController.xib's class names and outlets. In particular:
- Make sure your File's Owner is properly set to ThirdViewController.
- Make sure the view outlet of the File's Owner is properly connected to its view.
精彩评论