Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Multiple buttons UINavigation
// Create the toobar
UIToolbar* toolbar = [[UIToolbar alloc]
initWithFrame:CGRectMake(0, 0, 100, 45)];
[toolbar setBarStyle: UIBarStyleDefault];
// Create and array for the buttons
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3];
// Create a "+" button
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(addAction:)];
addButton.style = UIBarButtonItemStyleBordered;
[buttons addObject:addButton];
[addButton release];
// Create a spacer between them
UIBarButtonItem *spacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil
action:nil];
[buttons addObject:spacer];
[spacer release];
// Create an "Edit" button
UIBarButtonItem *editButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemEdit
target:self
action:@selector(editAction:)];
editButton.style = UIBarButtonItemStyleBordered;
[buttons addObject:editButton];
[editButton release];
// Add the buttons to the toolbar and release them
[toolbar setItems:buttons animated:NO];
[buttons release];
// Add the toolbar to the NavigationBar
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:toolbar];
[toolbar release];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.