iphone - Add a button to a navigation toolbar -


how can button added navigation toolbar in application navigation based?

the rootcontroller tableview default, , perfect. add "share" button navigation controller can attach own method.

how done if navigation bar added in code somewhere?

to in code, go views viewdidload method , create uibarbuttonitem

this code create button says share wanted , put on right hand side of navigation bar.

- (void)viewdidload {      [super viewdidload];      uibarbuttonitem *sharebutton = [[uibarbuttonitem alloc] initwithtitle:@"share"     style:uibarbuttonitemstylebordered target:self action:@selector(share)];      self.navigationitem.rightbarbuttonitem = sharebutton;     [sharebutton release]; } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -