• 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
registerUndoWithTarget:selector:object: in or outside of group?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

registerUndoWithTarget:selector:object: in or outside of group?


  • Subject: registerUndoWithTarget:selector:object: in or outside of group?
  • From: Jim Thomason <email@hidden>
  • Date: Thu, 24 Feb 2011 16:05:07 -0600

This is a braindead simple question, but I couldn't find a definitive reference.

Is it better to register an undo action inside or outside of a group?

i.e., is this preferred:

[someUndoManager beginUndoGrouping];
//do interesting things

//end group first
[someUndoManager endUndoGrouping];
//then register undo statement
[someUndoManager registerUndoWithTarget:self @selector(undoSomehow:)
object:magicalObject];

Or is this:

[someUndoManager beginUndoGrouping];
//do interesting things

//first register undo statement
[someUndoManager registerUndoWithTarget:self @selector(undoSomehow:)
object:magicalObject];
//then end group
[someUndoManager endUndoGrouping];


I'd always done it the former way, closing my group first and then
registering my undo target, and as far as I could tell it worked fine.
But in trying to debug an issue, I reached a point where I started
getting exceptions about registering my undo statement when no group
had been begun. So on a whim, I swapped it to the second method, and
that seems to have been the cure for what ailed me.

But now I'm trying to confirm if that is a correct fix, or if it's
just masking some other issue in my code (well, or both, I suppose).

-Jim....
_______________________________________________

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: registerUndoWithTarget:selector:object: in or outside of group?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: black flashes when updating CALayer content
  • Next by Date: Re: IBOutlet to different classes, conditional build
  • Previous by thread: Re: black flashes when updating CALayer content
  • Next by thread: Re: registerUndoWithTarget:selector:object: in or outside of group?
  • Index(es):
    • Date
    • Thread