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
Post a Comment