I'm trying to mark/unmark all the checkboxes in my NSTableView
, but they stay untouched when I set state to NSOnState
or NSOffState
func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
switch mode{
case .Normal:
let cell = tableView.makeViewWithIdentifier("record", owner:self) as? Record
cell?.translation.stringValue = ((array[row] as! NSManagedObject).valueForKey("result") as! NSArray)[0] as! String
cell?.source.stringValue = (array[row] as! NSManagedObject).valueForKey("source") as! String
return cell
case .Deletion:
let cell = tableView.makeViewWithIdentifier("record_del", owner:self) as? RecordDel
cell?.translation.stringValue = ((array[row] as! NSManagedObject).valueForKey("result") as! NSArray)[0] as! String
cell?.source.stringValue = (array[row] as! NSManagedObject).valueForKey("source") as! String
switch automark{
case .Mark:
cell?.checkbox.state = NSOnState
case .Unmark:
cell?.checkbox.state = NSOffState
case .None:
break
}
return cell
}
}
I tried calling cell?.checkbox.cell()?.display()
and cell?.checkbox.display()
and even cell?.display()
but still get no result. Is there a proper way to check a checkbox programmatically?
Aucun commentaire:
Enregistrer un commentaire