NavigationController as 2nd View
On my main view controller I have a button that shows a new view.
- (IBAction)showInformation:(id)sender {
InfoViewController *controller = [[InfoViewController alloc] initWithNibName:@"InfoView" bundle:nil];
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[self.view addSubview:[controller view]];
}
On my InfoView.xib I added a UINavigationController and made the proper connections. However when I the InfoViewController loads is not showing the 开发者_如何转开发UINavigation as I want it to.
Currently I have this on viewDidLoad
self.view = [navController view];
And on the header file I have
IBOutlet UINavigationController *navController;
@property (nonatomic, retain) IBOutlet UINavigationController *navController;
What am I missing?
UINavigation did not show you mean UINavigationController did not appear?
1 If you use UINavigationController, you need at least two views: one for the default view that appears with the controller and another that is pushed two.
I can only see one view here, which is InfoViewController.
If you use UINavigationController, you may want to use the pushViewController method.
2 If you use presentModalViewController method, no UINavigationCOntroller is needed.
精彩评论