문제

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!

도움이 되었습니까?

해결책

Added this line and it worked :

[TableView setColumnAutoresizingStyle:NSTableViewFirstColumnOnlyAutoresizingStyle];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top