Hi guys I'm new to Cocoa programming and I am getting always NSOffState whether I'm checking or unchecking an NSButtonCell (Check Box Cell in the UI dragged to a cell in an NSTableView). I have a @property IBOutlet NSButtonCell *mySelection, connected to the respective UI and the following code.
- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
MediaAComparar *media = [mediasRecesEnStock objectAtIndex:row];
NSString *identifier = [tableColumn identifier];
if ([identifier isEqualToString:@"seleccion"])
{
if ([mySelection state] == NSOnState)
{
[media setValue:object forKey:@"seleccion"];
NSLog(@"on state");
}
if ([mySelection state] == NSOffState)
{
[media setValue:object forKey:@"seleccion"];
NSLog(@"off state");
}
}
}
I never get the NSOnState to execute, the only NSLog message I get is: off state. Can anyone give me some help? Thanks!!