iOS 9 Swift Programming Cookbook (2015)
Chapter 1. Swift 2.0, Xcode 7 and Interface Builder
1.8 Adding Multiple Buttons to the Navigation Bar
Problem
You want to add multiple instances of UIBarButtonItem to your navigation bar.
Solution
In Xcode 7, you can now add multiple bar button items to your navigation bar. Simply open the Object Library and search for “bar button”. Once you find the buttons, drag and drop them onto your navigation bar then simply reference them in your code if you have to. For instance, Figure 1-3shows two bar buttons on the right-hand side of the navigation bar. In previous versions of Xcode, we could add only one button to each side. If we wanted more buttons, we had to write code to add them.
Discussion
Figure 1-3. Two buttons on the same side of the navigation bar
Prior to Xcode 7 you could not place multiple bar button items next to each other on your navigation bar. Well, now you can. You can also access these buttons just as you would expect, by creating a reference to them in your code. And you can always find them using the barButtonItemsproperty of your navigation bar.
See Also