I have an NSSegmentedControl with two segments set to "Select None" mode in Interface Builder. No matter what I try, I can't get -selectedSegment to return anything but 0, even though segment 0 is even disabled by default and can't possibly be selected. Here's the relevant function that gets called when you click any segment on the control:
-(IBAction)changeStep:(id)sender
{
[stepContainer setHidden:TRUE];
[(NSView *)[[wizard stepArray] objectAtIndex:(NSInteger)[wizard step]] removeFromSuperview];
switch ([[navigationButton cell] selectedSegment])
{
case 0:
[wizard setStep:(NSInteger *)[wizard step]-1];
break;
case 1:
[wizard setStep:(NSInteger *)[wizard step]+1];
break;
default:
break;
}
//[[navigationButton cell] setSelected:FALSE forSegment:[navigationButton selectedSegment]];
if ([wizard step] > 0)
{
[wizard setStep:0];
[navigationButton setEnabled:FALSE forSegment:0];
}
NSLog(@"%d", [wizard step]);
[stepContainer addSubview:(NSView *)[[wizard stepArray] objectAtIndex:(NSInteger)[wizard step]]];
[stepContainer setHidden:FALSE withFade:TRUE];
}
I've also tried using -isSelectedForSegment, but it has the same result.
Any help you can provide would be awesome, I have no idea what I'm doing wrong. Thanks!
SphereCat1
EDIT: This is a facepalm moment, see my answer below.
Alright, this is a facepalm moment. Turns out I was NSLogging the wrong thing, and there's just an error in my step increment/decrement logic.
All better! :)
facepalm
SphereCat1