Is there any way that I can have a UINavigationController and have it always display the same UIBarButtonItem no matter how many times it is pushed?
Try this-
CustomNavigationController) of UINavigationController & use it to push your view controllers.CustomNavigationController create UIBarButtonItem in init or in viewDidLoad. Add target & action to it.UINavigationControllerDelegate delegates in CustomNavigationController and set barButtonYouCreated as right or left bar button item for each view controller in delegate method.Use
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
viewController.navigationItem.leftBarButtonItem = barButtonYouCreated;
}
or
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With