How to add a UIBarButton programmatically AT a particular INDEX

74 views Asked by At

Currently i have a UIToolbar with 3 UIBarbuttons with indexes: Share: 0 Flexible space: 1 Play: 2 Flexible space: 3 Trash : 4

I want to be able to replace UIBarbutton at index 2 with another UIBarButtonItem programmatically. I know one way is to create an array and create all the bar buttons programmatically and manage the array accordingly. But here I have created everything in IB and want to change only 1 button on click (because you simply cannot change play to pause action in UIBarButtonItem).

EDIT: Particularly looking to REPLACE because editing Identifier in existing UIBarButtonItem programmatically is not possible.

0

There are 0 answers