What is required to support a column autoload query for a view- based table ? The docs are actually unclear on this issue and seem to be talking about cellular representations.
This is done by double-clicking on the column separator.
I can do this work by doing tableView:sizeToFitWidthOfColumn:for NSTableViewand outlineView:sizeToFitWidthOfColumn:for NSOutlineView, but the docs say it is only necessary for large tables. Is there a better way to do this?
- (CGFloat)tableView:(NSTableView*)tableView sizeToFitWidthOfColumn:(NSInteger)column {
NSUInteger n = [self numberOfRowsInTableView:tableView];
CGFloat w = 30;
NSTableColumn* col = [[tableView tableColumns] objectAtIndex:column];
for (int i=0; i<MIN(n, 100); ++i) {
NSView* vw = [self tableView:tableView viewForTableColumn:col row:i];
w = MAX(w, [vw frame].size.width);
}
return w;
}
source
share