Re: What do NSArrayController, etc. do for me?
Re: What do NSArrayController, etc. do for me?
- Subject: Re: What do NSArrayController, etc. do for me?
- From: Charles Srstka <email@hidden>
- Date: Fri, 13 Jan 2017 11:20:04 -0600
> On Jan 13, 2017, at 6:39 AM, Daryle Walker <email@hidden> wrote:
>
> If my data model supports KVC/KVO, it seems like I should be able to bind my views to my data directly via Cocoa Bindings, without using NSArrayController or NSObjectController or the like. What advantage do those classes give me?
>
> Sent from my iPhone
What does NSArrayController do? A heck of a lot:
- Automatic propagation of an NSTableView without your having to implement a data source.
- Automatic handling of sorting. So, if you click on a table header, that column is sorted for you without your having to worry about it. This is fairly sophisticated, as well; If you had column A selected before you clicked on column B, it will remember that, so two items that have an identical value for column B will get sorted according to their values in column A.
- Automatic selection management. So, you can bind a UI element to the array controller’s selected object, and that UI element’s content will change as the array controller’s selection changes. Pretty handy for implementing something like Mail.app’s UI where selecting a different e-mail message in the left-hand pane updates the right-hand pane with the contents of that message.
Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden