Re: Two Array Controllers, loading from CoreData, without a contentArray...
Re: Two Array Controllers, loading from CoreData, without a contentArray...
- Subject: Re: Two Array Controllers, loading from CoreData, without a contentArray...
- From: Richard Charles <email@hidden>
- Date: Tue, 22 Sep 2015 16:28:37 -0600
> On Sep 22, 2015, at 7:40 AM, Jim Thomason <email@hidden> wrote:
>
> The question is simple - is there a reasonable way to create two
> NSArrayControllers, have them bound to an entity through CoreData, and keep
> them in sync?
One way would be to bind the two array controllers to the same content array. The content array can be an array of managed objects. You may need a custom binding. Subclass and override -[NSArrayController remove:] to remove the selection from the managed object context. You may need to add objects to the managed object context through some other means as the array controller may not operate in entity mode without the content bound to a managed object context.
This may help when trying to programmatically initialize the controller.
http://stackoverflow.com/questions/1860805/nsarraycontroller-initialization
Another neat thing you can do with NSArrayController is chain two of them together.
http://www.informit.com/articles/article.aspx?p=1397563&seqNum=4
It is amazing how versatile NSArrayController can be but you may need to work with it and try some experimenting.
--Richard 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