I push a view controller onto a navigation controller like this:
[self.navigationController pushViewController:anotherViewController animated:YES];
And, then, inside anotherViewController I check self.navigationItem.BackBarButtonItem and LeftBarButtonItem, but they are always nil.
I can see the backBarButtonItem, and it seems to work fine.
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.
Basic Swift Code for iOS Apps To hide the back button on navigation bar we'll have to either set the navigation button as nil and then hide it or hide it directly. Let's create a project, add 2 view controller and Embed them in navigation controller.
From the Documentation: "When this item is the back item of the navigation bar—when it is the next item below the top item—it may be represented as a back button on the navigation bar. Use this property to specify the back button. The target and action of the back bar button item you set should be nil. The default value is a bar button item displaying the navigation item’s title."
I'm taking this to mean that it is convention for it to always be nil, and that the default value is always nil.
A similar subject about self.navigationItem.backBarButtonItem being nil was discussed here: Changing the UIBackButtonItem title
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