How do I make the “Add” button on a navigation bar do something?

前端 未结 1 497
粉色の甜心
粉色の甜心 2021-01-22 23:25

So I\'ve taken a few years off since my last iPhone programming adventure, and I\'ve apparently forgotten most of what I learned last time. Plus XCode looks totally different, s

相关标签:
1条回答
  • 2021-01-23 00:00
    addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addItem:)];
    
    self.navigationItem.rightBarButtonItem = addButton;
    

    Then you have to add a void method called "addItem", in which you have to define what do you want the Add button to do(in your case an actionsheet).

    0 讨论(0)
提交回复
热议问题