How to create navigation bar with navigation back button in a sub view page in iphone
Here i developing simple application iphone. I need to create navigation bar with navigation back button in iphone. I'm using view controller page. I want to implement navigation controller. But i could not create back button in next page. I also created navigation bar.
In a 2nd sub view page code is
-(IBAction)settingspage
{
Settingscontroller *objec=[[Settingscontroller alloc]initWithNibName:@"Settingscontroller" bundle:nil];
navigationController=[[UINavigationController alloc] initWithRootViewController:objec];
[self presentModalViewController:navigationController animated:YES];
[objec release];
[navigationController release];
}
In the using this code it will create navigation bar in 3rd sub view. But i dont knw how to create navigation bar with back button in the 3rd sub view page. How to create navigation bar with bac开发者_如何学运维k button in 3rd sub view using this code. Can anybody help me pls.
Back button will appear only in the view that was pushed to previously existing navigation bar using the method below:
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
If you will use that method and don't overwrite UIBarButtonItem *leftBarButtonItem
then back button will be created automatically.
The whole application should use a single navigation controller. So you shouldn't be creating new controller's if you want to stack the views one above another. However you would need to create new navigation controller only when you need different flow type in the newly presented views. From your question i can infer you are creating new navigation controller's. Hence the solution would be to use the navigation controller already created in the subsequent view controller's.
It can be done by accessing the navigationcontroller as follows:
self.navigationcontroller
精彩评论