I’ve a toolbar with 6 buttons all working fine with binding to the various functions.
One of the toolbar item buttons calls a Pause / Resume function and has the label of Pause,
when clicked I would like to change the label of the toolbar item to Resume.
I can’t seem to find a way in Xcode to bind the label to a variable, so how would you change the label?
You don’t need to do that through bindings – you just set the Alt. Title in the attributes pane of IB. The button has to be set to the toggle or switch Type for the title to change when you click it. If you log the button’s state in the action method, you will see it returns 1 when you click the button showing its title and 0 when its showing its alternate title.
If you need to do it through bindings, there is a Alternate Title binding in the parameters section of the binding’s pane for buttons. You can bind it to any property you want there.
Yes I see that Alt title box for other buttons eg push buttons, but this is an Image Toolbar item, and the alt Title field is not there in XCode4 for this.
Why are you using an image toolbar item? Do you need an image, and do you want the image to change too when you click it?
I am using an image toolbar item as my application needed a Toolbar just below its title bar, the only toolbar items I can find in Xcode are image Toolbar items, apart from the defaults of Print,Customize,Fonts etc, and as the toolbar is
for playback of media I have made play, pause, stop images for the toolbar items.
You can add an ordinary button to a toolbar.