NSArrayController Difficulties
NSArrayController Difficulties
- Subject: NSArrayController Difficulties
- From: Michael Niessner <email@hidden>
- Date: Sun, 5 Feb 2006 15:30:45 -0600
I have a MutableArray that contains some ManagedObjects(all objects
are the same entity) and an object that is not managed(which is just
an NSMutableDictionary). I use an NSArrayController to display the
array in a popup menu.
Whenever an entity is added or removed to the ManagedObjectContext, I
would like this array to be updated.
So, I registered for the
NSManagedObjectContextObjectsDidChangeNotification, and then check
the NSInsertedObjectsKey to see if any of the inserted objects should
be added to my MutableArray. If it should be added, then I call the
NSArrayController's addObjects: method in order to add the entity to
the MutableArray and the popup menu.
With this setup, on the first Insertion I get one notification.
However, on the second insertion I get two notifications. For the
third insertion I get four notifications. If I do not call the
addObjects method, I only get one notification for each insertion.
However, if I do call the addObjects method I get 2^n insertions.
What am I doing wrong?
Thanks,
Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden