Re: Removing an object from an ArrayController...
Re: Removing an object from an ArrayController...
- Subject: Re: Removing an object from an ArrayController...
- From: Scott Stevenson <email@hidden>
- Date: Thu, 18 Jan 2007 08:03:52 -0800
On Jan 17, 2007, at 6:32 AM, Colin Doncaster wrote:
If this is set, and I call removeObjectAtArrangedObjectIndex:
( which breaks the relationship and then marks the object for
delete ) but create a new relationship straight away - will the
object still be deleted or will creating the new relationship
remove the delete request?
Interesting question. The easiest way to find out is to just write
some test code with NSLog, but I'm guessing the object would still be
deleted since I believe the array controller determines that
particular delete behavior, not the managed object itself. Just a
guess, though.
I think NSManagedObject's -isDeleted will help you.
As a side note, if the remove actually just breaks the relationship
does that mean there's a chance a lot of unassociated objects can
live within the graph with no way ( unless I write a method for
inspecting the graph for them ) to clean them up?
Assuming you have inverse relationships set up, you can just look for
"orphan" objects by searching for null relationships (using an
NSPredicate with a NSFetchRequest).
- Scott
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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