Reputation: 5
I'm making a app that uses a UIToolbar. My app has 8 different views and the toolbar is the same in all of them (the same buttons/images that is). The toolbar has 3 buttons. Two of them has the same (ib)action in all the views and 1 button has a specific action for each view.
My problem is that I can't get my head around how to implement it in the right way.
I tried to create and add the toolbar and the buttons in the AppDelegate. It looks right but I can't figure out how to do with the button that has a specific action for each view.
I've also tried to create and and the buttons in each view. Then it's easy to add the specific action, but it doesn't look and feel right.
This is the (ib)actions of the views, if it helps:
Button 1: popToRootViewController
Button 2: resize the current view (it's a UIWebView in all of the 8 views)
Button 3: show a overlay-view
Thanks in advance.
Upvotes: 0
Views: 361
Reputation: 33335
When showing each view, reassign the action associated to the button to be view specific
[aToolBarBtn addTarget:self action:@selector(viewSpecificAction:)
forControlEvents:UIControlEventTouchUpInside];
Upvotes: 1