How can I set the width of an NSTableColumn according to the size of it's data cells (the cells are all the default NSTextFieldCell objects).
currently I'm caculating the width by retrieving the NSString that is supposed to be displayed in that cell and sending it the "sizeWithAttributes:nil" method, to get the string's size. I do this for all cells in the column, and then use the maximum width returned.
This almost works, but the width of the string, does not appear to be an accurate measure of the width of the column/cell needed to display it.
For small strings, I need to add about 4 to the width. For larger strings, I need to add more.
In any case, even if it was accurate, this seems to be a very kludgy way of sizing a column to fit it's data content. Is there any better way?
(I notice the the "sizeToFit" method for the NSTableColumn, attempts to fit the header content, but there appears to be nothing to do the same for the data content).