Re: How does prepareWithInvocationTarget work?
Re: How does prepareWithInvocationTarget work?
- Subject: Re: How does prepareWithInvocationTarget work?
- From: "Martin" <email@hidden>
- Date: Mon, 08 May 2006 18:16:02 -0700
>I was calling prepareWithInvocationTarget and handing the undoManager a message with
>a long argument list. Some arguments were NSObjects and some were primitive data types.
>(Is that allowed?)
Yes, that is definitely allowed.
>Forgive my objective-c ignorance but how is prepareWithInvocationTarget even possible?
>How does the undo manager know what to retain?
Basically when you call "prepareWithInvocationTarget" the NSUndoManager stops responding to all methods directly. The next message you send to it will not be recognized and the Objective-C runtime will call "forwardInvocation:". See:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSObject.html#//apple_ref/occ/instm/NSObject/forwardInvocation:
At this point it can use NSInvocation's "retainArguments" method:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSInvocation.html#//apple_ref/occ/instm/NSInvocation/retainArguments
~Martin
_______________________________________________
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