Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Debugging a specific object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging a specific object



If you want to log all calls to all instances of your class, rather than replacing all [[MyButton alloc] init] methods in your code, you could just change your init method to return the proxy. For instance, MyButton's init method may look like:

- (id) init
{
// normal initialization
if( self = [super init] ) {
// setup ivars
}

// return proxy instead of ourself
id proxy = [[MyProxy alloc] initWithTarget:self];
[self release];
return proxy;
}

This way you only have one source file to modify when you want to switch your proxy on/off.

~Martin


On July 07 2004, Tim Hewett <email@hidden> wrote:

>So instead of:
>
> MyButton *button = [[MyButton alloc] init]; // or whatever you do to
>create the button
>
>you do:
>
> MyButton *tmpButton = [[MyButton alloc] init]; // or whatever you do
>to create the button
> id button = [[TargetProxy alloc] initWithTarget:tmpButton];
>
> // continue making calls to button, forget it is a proxy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.