我有一个带有4列的NstableView。我想更改第一个NstableColumn的自动调整属性。如果用户调整了应用程序大小,则仅允许第一列更改其宽度。我的代码:

// 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];

如您所见,这些列是通过编程添加的。

谢谢!

有帮助吗?

解决方案

添加了这条线并起作用:

[TableView setColumnAutoresizingStyle:NSTableViewFirstColumnOnlyAutoresizingStyle];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top