Search code examples
iosuitoolbar

How to group toolbar items in iOS project?


in many iOS projects you can see toolbar items that are grouped like this

enter image description here

As you can see the arrows are grouped. Any idea how to achieve this by code?


Solution

  • Actually you can put anything (any View) in UIToolbar. Every UIBarButtonItem has a property "customView". Just set the customView any view you want. In this case it's a UISegmentedControl. You can also simply drag out an UISegmentedControl onto your UIToolbar in Interface Builder.