简体   繁体   中英

Editable OutlineView with Cocoa Bindings

How do you bind the NSOutlineView (or NSTableView) so that the items can be editable? I know that there's the editable field for it but I'm not sure how to use it so any help for it would be nice. I have a NSTreeController that's bind to a NSArray. Thanks.

Editable is not a property of NSTableView or NSOutlineView but of NSTableColumn. And if you check Cocoa Bindings Reference, you'll find that NSTableColumn also exposes an NSEditableBinding (well, it doesn't say so, but it does -- one of the idiosyncrasies of Apple's documentation). When you set the binding, either programmatically (bind:) or in IB, add or check NSConditionallySetsEditableBindingOption to the options, and you're all set.

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