I Have a view with a button. I want to press the button and that a Navigation Controller will appear, and in it there will be a back button that will bring me to the original view.
this is how i load the Navigation Controller:
-(IBAction) viewButtonPressed:(id) sender
{
[self.view addSubview:navController.view];
[self.view bringSubviewToFront:navController.view];
}
in the rootController of the NAvagtion Controller I tried this, but it does not work (the back button does not even appear):
@implementation rootViewController
- (void)viewDidLoad {
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(customGoBack:)];
}
navigationController is the stack of viewControllers. You didn’t push any controller except root to this stack, so there is no back button in the navigationBar. You can create separate controller to push it into the navigationController’s stack. If you son’t want to see navigationBar on your first controller’s view, just send
- (void)setNavigationBarHidden:YES animated:NOto your instance of UINavigationController.