• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController -addObjects and undo - [improved but still confused]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController -addObjects and undo - [improved but still confused]


  • Subject: Re: NSArrayController -addObjects and undo - [improved but still confused]
  • From: "email@hidden" <email@hidden>
  • Date: Tue, 10 Nov 2009 13:16:30 +0000

On 9 Nov 2009, at 20:58, email@hidden wrote:

> My Entry objects are an NSManagedObject subclass.
>
> I create an NSArray of N Entries and add them to my array controller like so.
> [self.arrayController addObjects:newEntries];
>
> I am observing [self.arrayController arrangedObjects] and receive a single observation following the above call.
>
> However, when I undo this operation I get N observations of [self.arrayController arrangedObjects].
>
Looking at [[self.arrayController arrangedObjects] count] I can see that the array size is maintained while the observations occur.
So it's not as if the added entries are being removed/undone one at a time.

I am using KVO on my managed object properties and debugging seems to indicate that these observations are the source of the issue during the undo.

So I have found a work around:

If I override -didChangeValueForKey: and -didChangeValueForKey: so that notifications are not
sent while an undo is in progress then I don't get the unanticipated arrangedObjects observations.

Yet I don't understand why I have to do this. Why does undo affect the arrangedObjects in this way?


> Is this expected behaviour or am I screwing up on my KVO somewhere?
> I have not changed the default undo manager grouping behaviour.
>
> Running OS X 10.6
>
> Regards
>
> Jonathan Mitchell
>
> Developer
> http://www.mugginsoft.com
>
>
>
>
>
>
> _______________________________________________
>
> 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

_______________________________________________

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

  • Follow-Ups:
    • Re: NSArrayController -addObjects and undo - [improved but still confused]
      • From: Quincey Morris <email@hidden>
References: 
 >NSArrayController -addObjects and undo (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: cocoabuilder.com
  • Next by Date: EXC_BAD_ACCESS mystery
  • Previous by thread: NSArrayController -addObjects and undo
  • Next by thread: Re: NSArrayController -addObjects and undo - [improved but still confused]
  • Index(es):
    • Date
    • Thread