Add items to NavigationBar (Not using UINavigationController)

后端 未结 5 498
北恋
北恋 2020-12-31 13:07

I have a UIViewController with a UITableView in it, and also added a UINavigationBar. How can I add and \"edit\" button and a \"+\" button in that bar programmatically? (I h

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-31 13:40

    Just use your viewController's navigationItem property.

    like this:

     self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(updateContent)];
    

提交回复
热议问题