I have an NSTableView (View type, not Cell type) which is resulting in text with "..." at the end. When I resize the columns, the "..." doesn't go away, indicating that the size is being set somewhere else... but I'm not sure where.
Here is what the table looks like:
When I make it bigger, the text is still truncated:
If I take out the ".ByClipping", I get this:
Here is the code that makes the cell:
func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
let identifier = tableColumn!.identifier
let networkName = displayedNetworks[row]
let networkVals = model.networks[networkName]!
if let val: AnyObject = networkVals[identifier] {
var obj = tableView.makeViewWithIdentifier(identifier, owner:self)
if (obj==nil) {
// No existing cell to reuse, so make a new one
obj = NSTableCellView(frame:NSMakeRect(0,0,400,400))
obj!.identifier = identifier
}
let cellView = obj as! NSTableCellView
if let d = val as? NSDate {
let formatter = NSDateFormatter()
formatter.dateStyle = NSDateFormatterStyle.ShortStyle
formatter.timeStyle = .ShortStyle
cellView.textField!.stringValue = formatter.stringFromDate(d)+"****"
cellView.textField!.lineBreakMode = .ByClipping
}
else {
cellView.textField!.stringValue = "\(val)"
}
return cellView
}
return nil
}
Something is wrong, but I can't figure it out. I thought that resizing the column resized the contained cells. Mine aren't. This is only happening with the cells that are displaying dates. What should I do?