Re: respondsToSelector - #import OR compiler warnings?
Re: respondsToSelector - #import OR compiler warnings?
- Subject: Re: respondsToSelector - #import OR compiler warnings?
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 30 Dec 2008 16:03:32 -0800
On Dec 30, 2008, at 3:51 PM, mmalc crawford wrote:
I hope Bill will forgive me adding another option.
With this pattern, it's also common for your protocol to adopt
another protocol, such as NSObject:
@MyProtocol <NSObject>
@optional
- (void)myMethod;
@end
This way you can test your delegate using respondsToSelector:
without the compiler complaining.
No, no, Malcolm. I will not forgive you. Not at all. You owe me
for THAT one...
Back here in reality, Mmalc is absolutely right. You can either add
<NSObject> as he suggests, or declare that your delegates are
subclasses of NSObject (which does the same in a roundabout way):
NSObject<BobsYourDelegateProtocol> *myBob;
b.bum
_______________________________________________
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