In Safari, when I press a dropdown box, a picker comes up with a navigation bar on top of it that has a done button and some other buttons.
I want a similar bar with two buttons above my picker view, but I can’t figure out how to put buttons on the bar. With a navigation controller, I’d do:
self.navigationItem.rightBarButtonItem = [UIButton .....
self.navigationItem.backBarButtonItem = [UIButton ......
But I’m not finding any button properties on the navigation bar that I’m creating programmatically. Adding the buttons as subviews also doesn’t seem to be doing anything. How can I add them?
It’s a toolbar, not a navigation bar. Set its
itemsproperty to populate it with UIBarButtonItem objects. Note that those are not the same as UIButtons, and in fact don’t even subclass from UIView; they have their own set of attributes. A simple example: