UINavigationBarDelegate protocol defines optional methods that a
UINavigationBar delegate should implement to update its views when items are pushed and popped from the stack. The navigation bar represents only the bar at the top of the screen, not the view below. It’s the application’s responsibility to implement the behavior when the top item changes.
- iOS 8.0+
- tvOS 9.0+
You can control whether an item should be pushed or popped by implementing the
navigationBar(_:shouldPop:) methods. These methods should return
true if the action is allowed; otherwise,
The screen should always reflect the top item on the navigation bar. You implement the
navigationBar(_:didPush:) method to update the view below the navigation bar to reflect the new item. Similarly, you implement the
navigationBar(_:didPop:) method to replace the view below the navigation bar.