简体   繁体   中英

Bind NSTableColumn to NSArrayController programmatically

How can i bind a NSTableViewColumn to an NSArrayController programmatically? i have a table with 2 columns that are already bound to the array controller. but i am adding new columns at Runtime, and these need to be bound to the arrangedObjects of the arraycontroller. its a cellbased 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..

Any help appreciated.

thanks

用NSValueBinding替换“值”应该工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM