UINavigationItem setRightBarButtonItem example in Objective C (iOS).

UINavigationItem setRightBarButtonItem

Parameters of [UINavigationItem setRightBarButtonItem]
item
A custom bar item to display on the right of the navigation bar.
animated
Specify YES to animate the transition to the custom bar item when this item is the top item. Specify NO to set the item immediately without animating the change.

Discussion of [UINavigationItem setRightBarButtonItem]
If two navigation items have the same custom left or right bar button items, those bar button items remain stationary during the transition when the navigation item is pushed or popped.