Can you add buttons to navigation bars through storyboard?

前端 未结 2 1822
走了就别回头了
走了就别回头了 2020-12-13 01:45

At the moment, I\'ve been adding navigation buttons like follows:

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@\"Add\"
           


        
相关标签:
2条回答
  • 2020-12-13 02:15

    As of Xcode 6, it looks like the navigation item on the navigation bar is no longer created automatically.

    You'll need to drag out a Navigation Item onto the navigation bar first before you can drag out a Bar Button Item (as detailed in Rob's answer) to add to the navigation item.

    0 讨论(0)
  • 2020-12-13 02:22

    You can just drag out a Bar Button Item and drop it on the right end of the view controller's navigation bar:

    enter image description here

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