Hi... first time I've asked a Cocoa programming question here (in the past I've always been in the iOS section asking about Cocoa Touch,) but... hope you guys are just as helpful.
Here's what I have:
- Two radio buttons
- A property for which one is selected.
- A property for whether they're enabled or not.
The two properties are bound to the buttons. The enabled binding works perfectly. The selection one, on the other hand, only seems to work in one direction. When the user clicks on a button, the app responds properly. When I attempt to set the property programmatically though, the button doesn't set itself graphically.
Any idea what I'm doing wrong? Here's some of the code...
From the header:
setPreferred: just stores the setting in NSUserDefaults (along with setting it, of course.) Both preferred and allowPrefer are synthesized.
I think that covers everything... any idea what I'm doing wrong?
Here's what I have:
- Two radio buttons
- A property for which one is selected.
- A property for whether they're enabled or not.
The two properties are bound to the buttons. The enabled binding works perfectly. The selection one, on the other hand, only seems to work in one direction. When the user clicks on a button, the app responds properly. When I attempt to set the property programmatically though, the button doesn't set itself graphically.
Any idea what I'm doing wrong? Here's some of the code...
From the header:
Code:
@property (setter = setPreferred:) int preferred;
@property BOOL allowPrefer;
setPreferred: just stores the setting in NSUserDefaults (along with setting it, of course.) Both preferred and allowPrefer are synthesized.
Code:
if (allowExternal && (!allowInternal))
{
// Force preferred to be 0 (external only.)
self.preferred = 0;
self.allowPrefer = NO;
}
else if (allowInternal && (!allowExternal))
{
// Force preferred to be 1 (internal only.)
self.preferred = 1;
self.allowPrefer = NO;
}
else
{
self.allowPrefer = YES;
}
I think that covers everything... any idea what I'm doing wrong?
Last edited: