I’ve read a couple similar questions regarding this topic on StackOverflow, but none of them apply to my case.
I have a UIToolbar on my application. The ToolBar has a layout like the following.
(Button #1) (Button #2) (Button #3) <--- Flex Controller ---> (Button #4)
What is the most efficient way to Show/Hide the Button #3 UIBarButtonItem since it is in the middle of the UIToolbar?
FOLLOW-UP
I am aware of the setItems:Animated method, but this seems like it could be problematic because all of my buttons are wired through IB and they have associated IBActions.
Does this mean that I, therefore, need to find a way to retain my Button #3 when it is hidden (since I am using ARC?) I’m looking for the most optimal/efficient method for adding and removing these objects. If I must recreate this list each time I have to show/hide my #3 button, that’s what I will do.
It just seems so inefficient.
I would recommend building a helper function in the following manner:
This then has the benefit of being available whenever you need to update it and then you can easily add/remove the button. In order for this to work, you would need to have the buttons available in your implementation file as IBOutlets and they would be easily referenced for rebuilding the toolbar.