Re: NSArrayController Difficulties
Re: NSArrayController Difficulties
- Subject: Re: NSArrayController Difficulties
- From: Michael Niessner <email@hidden>
- Date: Sun, 5 Feb 2006 16:20:54 -0600
I figured out my problem. I was registering for the notification more
than once. Sorry for the noise.
Michael
On Feb 5, 2006, at 3:30 PM, Michael Niessner wrote:
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:
40aventive.com
This email sent to email@hidden
_______________________________________________
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