| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
That's much more sensible. I'll do that. Thanks.
Regards, Jeremy
On 5 Dec 2004, at 5:26 pm, Nick Zitzmann wrote:
On Dec 5, 2004, at 5:14 AM, Jeremy Dronfield wrote:
- (id)browserDelegate
{
return [(NSBrowser *)[[[[[[self superview] superview] superview] superview] superview] superview] delegate];
}
which seems somewhat ludicrous. There must be a smarter way?
Yes. What I usually do is add a category to NSView that returns the first superview that is of a certain class, like this: (warning - written in Mail, untested, you know the rest)
- (id)firstSuperviewOfClass:(Class)aClass { id aSuperview = [self superview];
while (aSuperview != nil) { if ([aSuperview isMemberOfClass:aClass]) { break; } aSuperview = [aSuperview superview]; } return aSuperview; }
Then you can pass in the browser's class and message the browser that way...
Nick Zitzmann <http://www.chronosnet.com/>
_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
| References: | |
| >Easier way to call NSBrowser's delegate from browser matrix? (From: Jeremy Dronfield <email@hidden>) | |
| >Re: Easier way to call NSBrowser's delegate from browser matrix? (From: Nick Zitzmann <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.