After I run my application in iOS 8 (XCode 6.0.1, iPhone 6), the back button does not hide.
My code:
- (void)removeCategoriesButton
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
[_navigationController.topViewController.navigationItem setHidesBackButton:YES];
[_navigationController.topViewController.navigationItem setLeftBarButtonItem:nil];
} else {
UIViewController *controller = _app.window.rootViewController;
if ([controller isKindOfClass:[UINavigationController class]]) {
UINavigationController *nav = (UINavigationController *)controller;
[nav.topViewController.navigationItem setHidesBackButton:YES];
[nav.topViewController.navigationItem setLeftBarButtonItem:nil];
}
}
}
But the back button does not hide (see screenshot):
UPD:
I run application in another simulators, and i see this "bug" only on iOS 8.
You can do: [self. navigationItem setHidesBackButton:YES]; In your second view controller (the one you want to hide the button in).
Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.
The . navigationBarBackButtonHidden(true) will hide the back button.
This worked for me.
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationItem setHidesBackButton:YES];
[self.navigationItem setTitle:@"Home"];
}
I tried many of the answers but the only one that worked for me was:
override func viewDidLoad() {
super.viewDidLoad()
let backButton = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: navigationController, action: nil)
navigationItem.leftBarButtonItem = backButton
}
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