Objective c 在NSTableView中设置NSButtonCell复选框值

Objective c 在NSTableView中设置NSButtonCell复选框值,objective-c,cocoa-touch,cocoa,Objective C,Cocoa Touch,Cocoa,我有两列NSTableView,一列带有复选框,另一列带有NSString 我想将所有复选框定义为true 我试着用: if (tableColumn == first) { return YES; }else if (tableColumn == second) { NSString *country = [array objectAtIndex:row]; return [country lastPath

我有两列NSTableView,一列带有复选框,另一列带有NSString

我想将所有复选框定义为true

我试着用:

    if (tableColumn == first) {
            return YES;
    }else if (tableColumn == second) {
            NSString *country = [array objectAtIndex:row];
            return [country lastPathComponent];
    }

但当我启动应用程序时,它会使我崩溃。

看起来您的代码正在
表视图:objectValueForTableColumn:row:
中执行。在这种情况下,表视图只接受对象,而不接受基元值

尝试将
return YES
更改为
return[NSNumber numberWithBool:YES]