Hi,
I have a preference window with four NSButtons that are all connected to a
method and an IBOutlet:
IBOutlet NSButton *buttonA;
IBOutlet NSButton *buttonB;
IBOutlet NSButton *buttonC;
IBOutlet NSButton *buttonD;
NSUserDefaults *prefs;
Now I would like to set the state of these buttons according to some
UserDefaults:
-(void)awakeFromNib {
prefs = [NSUserDefaults standardUserDefaults];
BOOL st = [prefs boolForKey:@"optionA"];
if(st == YES) { [buttonA setState:NSOnState]; }
else if(st == NO) { [buttonA setState:NSOffState]; }
st = [prefs boolForKey:@"optionB"];
if(st == YES) { [buttonB setState:NSOnState]; }
else if(st == NO) { [buttonB setState:NSOffState]; }
st = [prefs boolForKey:@"optionC"];
if(st == YES) { [buttonC setState:NSOnState]; }
else if(st == NO) { [buttonC setState:NSOffState]; }
st = [prefs boolForKey:@"optionD"];
if(st == YES) { [buttonD setState:NSOnState]; }
else if(st == NO) { [buttonD setState:NSOffState]; }
}
The code is exactly the same. I checked the connections in the interface
builder twice.
There is no problem with getting the NSUserDefaults values.
But still, only the state of button A and B change according to the st-value.
On button B and C setState: seems to have no effect at all.
Whatever I send to buttonB and buttonC nothing changes the appearance of this
buttons in the window.
The code is identical.
There is nothing wrong with the plist and I don`t see any differences in the
connections in the IBuilder...
When I debug this code I see that buttonA and buttonB have an address.
But buttonC and buttonD seems to have no address (0x0) ...
what could possibly be the problem here ...?
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]