[英]Bind NSTableColumn to NSArrayController programmatically
How can i bind a NSTableViewColumn to an NSArrayController programmatically? 我如何以编程方式将NSTableViewColumn绑定到NSArrayController? i have a table with 2 columns that are already bound to the array controller.
我有一个具有2列的表已经绑定到阵列控制器。 but i am adding new columns at Runtime, and these need to be bound to the arrangedObjects of the arraycontroller.
但是我要在运行时添加新列,并且这些列需要绑定到arraycontroller的rangedObjects。 its a cellbased NSTableview.
其基于单元格的NSTableview。 I only found this code online but am not able to make it work..
我只在网上找到此代码,但无法使其工作..
NSString *akey = @"somekey";
NSString *keypath = [NSString stringWithFormat:@"arrangedObjects.%@",akey];
[newColumn bind:@"value" toObject:arrayController withKeyPath:keypath options:nil];
i am not sure about the "bind:" part and did not understand the apple documentation, that says that i have to expose a binding.. 我不确定“ bind:”部分,也不了解苹果文档,即我必须公开一个绑定。
Any help appreciated. 任何帮助表示赞赏。
thanks 谢谢
用NSValueBinding替换“值”应该工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.