Re: Selector not working for me
Re: Selector not working for me
- Subject: Re: Selector not working for me
- From: Andy Lee <email@hidden>
- Date: Mon, 2 May 2005 11:20:41 -0400
On May 2, 2005, at 2:03 AM, Phil Larson wrote:
On May 1, 2005, at 5:55 AM, John James wrote:
if ([Seltest respondsToSelector: @selector(test1:)]==YES)
NSLog(@"YES");
else
NSLog(@"NO");
I always get NO!
Shouldn't it be YES?
Thanks for your help
John,
You need to make an instance of Seltest first.
Or use +instancesRespondToSelector:, as follows:
if ([Seltest instancesRespondToSelector: @selector(test1)])
NSLog(@"YES");
else
NSLog(@"NO");
You can use this method, for example, if you aren't sure you *want* to
create an instance of the class, and your decision depends on whether
it would respond to the selector.
--Andy
_______________________________________________
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