I've recently upgraded from Lion to MountainLion and the newest xCode. The app im working on has deployment target 10.7.
I've a NSButton
setup in the Interfacebuilder with Title: "Start" and Alternate: "Stop". In the buttons IBAction
I check the state of the application (BOOL isRunning) and change the state every time the button is pressed like this:
[startStopButton setState:[appDelegate.dataController appIsRunning]];
Everything worked fine. Since I upgraded to the new xCode the button does not change the title anymore.
Setting the titles via code: Did not work.
[startStopButton setTitle:@"Start"];
[startStopButton setAlternateTitle:@"Stop"];
Thought it may have been a problem with the boolean value. So I checked if the button is not in mixed mode. Then hardcoded statechanges with 1 and 0 from type int. No change at all.
Somehow when I use [startStopButton setTitle:@"TEST"]
and then change the state, it changes the state ONCE to alternate but not back anymore. The "TEST" String is never seen on the button also...
I logged the value of [appDelegate.dataController appIsRunning]
and
it returns the correct values.
I have no clue how to solve this. Everything worked fine, I changed nothing and it doesn't make any sense to me. Has anybody encountered a equivalent problem?
In Interface Builder, change the button type to "Toggle". I'm not sure of the reason, but it appears that alternate title does not work for "Momentary" and "Push" button types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With