Question

Background Information:

I've recently upgraded from Lion to MountainLion and the newest xCode. The app im working on has deployment target 10.7.

Problem:

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.

Things I already tried out:

  • Checked all the connections between IBAction and IBOutlet according this button. Reset everything up. Did not help.
  • Created a new NSButton tried the same. Did not work.
  • 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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top