Re: Is selector in protocol?
Re: Is selector in protocol?
- Subject: Re: Is selector in protocol?
- From: email@hidden
- Date: Thu, 25 Oct 2001 00:03:32 +0200
On Wednesday, October 24, 2001, at 11:54 PM, John C. Randolph wrote:
On Wednesday, October 24, 2001, at 01:59 PM,
email@hidden wrote:
On Wednesday, October 24, 2001, at 10:15 PM, Paul Mix wrote:
Is there a way to tell if a particular selector is declared in a
formal protocol? I'd like to use forward-invocation on an object,
determining which object to forward to based on which protocol the
forwarded-selector is declared in.
Look at "/usr/include/Protocol.h".
Actually, /usr/include/objc/protocol.h.
Quite right. (Note to self: Never write paths from memory.)
How about
if([@protocol(someProtocol) descriptionForInstanceMethod:theSelector])
I don't think this is legal. @protocol is a compiler directive to
begin a protocol declaration, like @interface or @implementation. It's
not like @selector or @encode.
That line should be:
if([someProtocol descriptionForInstanceMethod:theSelector])
No it should not.
[NSObject descriptionForInstanceMethod:theSelector] is very different
from [@protocol(NSObject) descriptionForInstanceMethod:theSelector].
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com