Skip to content

Adding UIBarButtonItem to Navigation Controller

May 1, 2010

Here’s a quickie:

UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@”My Button” style:UIBarButtonItemStylePlain target:self action:@selector(myButtonAction)]; — initialize a UIBarButtonItem object with a title, style (plain), and an onClick action

self.navigationItem.rightBarButtonItem = barButton; — place the UIBarButtonItem onto the navigation bar

[barButton release];

Advertisements

From → regular

One Comment
  1. Absolutely amazing. Cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: