I’d like to have a UIViewController which has an Add and a Trash button both right to the title, either by adding two UIBarButtonItems to the navigation item/bar or by adding them to a UISegmentedControl and then adding the SegmentedControl to the item. Is this possible? If yes, how is it achieved best?
I’d like to have a UIViewController which has an Add and a Trash button
Share
I have done something similar. I’ve added two UIButtons to a navigation item/bar by creating a UIView subclass that has two UIButtons in it. You can then do something like this:
All you have to do is layout the buttons in
MyUIViewSubclassand you’re good.Also, I pass the ID of the target along in a customized init command to make for easier targeting of the buttons in the view. So for
MyUIViewSubclassinstead ofinitWithFrame, I have something like this: