Bar Buttons

To add new buttons, you modify your navigationItem, which provides a representational class that describes the content shown on the navigation bar, including its left and right bar button items and its title view. Here’s how you can assign a button to the bar:

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]     initWithTitle:@"Action" style:UIBarButtonItemStylePlain target:self     action:@selector(performAction:)];

To remove a button, assign the item to nil. Bar button items are not views. They are classes that contain titles, styles, and callback information that navigation items and toolbars use to build actual buttons in to interfaces. iOS does not provide you with access to the ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.