Re: NSArrayController Undo
Re: NSArrayController Undo
- Subject: Re: NSArrayController Undo
- From: Richard Somers <email@hidden>
- Date: Fri, 14 May 2010 11:44:02 -0600
On May 14, 2010, at 10:25 AM, Quincey Morris wrote:
If I understand you correctly, you're on the right track -- you want
to bind the array controller's selection indexes to your data
model's selection property. However, Core Data properties don't
support index sets as a standard data type, so you have more work to
do. Since NSIndexSet supports NSCoding, your easiest choice is
probably to make your selection a transformable attribute. That
means Core Data automatically converts the value to and from an
archive using a standard transformer.
I see what you are saying. The path I was following was a little
different. Each model object has a 'selected' attribute or property.
When the array controller selection is set, the model objects
'selected' property is also set. What I was trying to do was figure
out how to get each model object's 'selected' property back into the
array controller's selection.
You are suggesting that I just use the array controller's selection,
which is an index set, and just put that into Core Data. That would
work for a transient property but not for an on disk persistent store.
The index set of the array controller is based on an in-memory
arrangement of model objects and could change and does change from one
document opening to the next. But if I do not need persistence this
might be the way to go.
--Richard
_______________________________________________
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