Xcode: Multiple Buttons in the Navigation Bar in iOS

Navigation / Tutorials

Intro:
Sometimes when you’re working with a UINavigationcontroller in your projects you’ll want to put more than one button on each side of the navigation bar. This tutorial will walk you through that.

Key Code:

UIBarButtonItem *myAddButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(myAddAction:)];


UIBarButtonItem *myCoolButton = [[UIBarButtonItem alloc] initWithTitle:@"Cool!" style:UIBarButtonItemStyleDone target:self action:@selector(myCoolAction:)];


NSArray *myButtonArray = [[NSArray alloc] initWithObjects:myCoolButton, myAddButton, nil];

self.navigationItem.rightBarButtonItems = myButtonArray;

Download the project:

Julian Bryant


Related Posts

Objective C: Saving User Preferences

iOS App Starts Trounce Android Development

iOS App Starts Trounce Android Development

Building Your First App: The “HelloWorld” Tour of XCode

Building Your First App: The “HelloWorld” Tour of XCode

Image of Pop-up Window for Setting Properties

Quick Tip: Shortcut for setting @property/@synthesize in Xcode

Mobile Developers Excited About iCloud & Google+

Nav Bar 3: Using Custom Images in the Nav Bar for iOS

Nav Bar 3: Using Custom Images in the Nav Bar for iOS