Question

I have an NSTableView with 4 columns. I want to change the auto resizing properties of the first NSTableColumn. If the user resizes the app, only the first column is allowed to change his width. My code :

// First 3 columns similar to the 4th one.
NSTableColumn*  Column4     = [[[NSTableColumn alloc] initWithIdentifier:@"Column4"] autorelease];
[[Column4 headerCell] setStringValue:@"-"];
[Column4 setWidth:15];
[tableView addTableColumn:Column4];
[tableView setDataSource:self];

As you can see, the columns are added programmatically.

Thanks!

Was it helpful?

Solution

Added this line and it worked :

[TableView setColumnAutoresizingStyle:NSTableViewFirstColumnOnlyAutoresizingStyle];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top