简体   繁体   中英

Manual binding with NSTableColumn (without NSArrayController)

I want to use bindings in a table view, but I'm not using an NSArrayController. I've tried binding an array to my NSTableColumn (I'm handling sorting/searching myself), but it doesn't work. Is there some sort of magic under the hood that NSTableView/NSTableColumn exert when bound to an NSArrayController? More importantly, is NSArrayController useful for anything other than a NSTableView?

The magic is definitely in the NSArrayController. NSArray doesn't have methods like selectedObject and such that bindings to NSTableColumn require. NSArrayController as the name suggests is the controller part of MVC where the model is an NSArray.

Secondly, NSArrayController is useful for any view that has an NSArray model backing it. Admittedly, this is usually NSTableView but it could be any view that uses the same data.

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