iOS Developer Library


UIKit Framework Reference UINavigationBarDelegate Protocol Reference

Deployment Target:

On This Page


The 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.

You can control whether an item should be pushed or popped by implementing the navigationBar:shouldPushItem: and navigationBar:shouldPopItem: methods. These methods should return YEStrue if the action is allowed; otherwise, NOfalse.

The screen should always reflect the top item on the navigation bar. You implement the navigationBar:didPushItem: method to update the view below the navigation bar to reflect the new item. Similarly, you implement the navigationBar:didPopItem: method to replace the view below the navigation bar.