Re: NSObjet respondsToSelector:method does not work when the method has arguments.
Re: NSObjet respondsToSelector:method does not work when the method has arguments.
- Subject: Re: NSObjet respondsToSelector:method does not work when the method has arguments.
- From: Ondra Cada <email@hidden>
- Date: Sat, 31 Aug 2002 02:05:35 +0200
On Saturday, August 31, 2002, at 01:35 , Bruce Wittenmyer wrote:
NSObject respondsToSelector:method does not work when the selector has
arguments.
It does.
Anyone know how verify selectors with arguments? What I'm doing wrong?
Using a different selector.
- (void)foo1;
- (void)foo2:(id)theArgs;
=20
@end
=20
@implementation MyClass
=20
- (IBAction)clickedButton:(id)sender
{
=20
SEL method1;
SEL method2;
=20
method1 =3D NSSelectorFromString(@"foo1");
method2 =3D NSSelectorFromString(@"foo2");
=20
// ARG!!! Why doesn't this work? respondsToSelector does not find
Since foo2 is definitely not what you wanted. Try @"foo2:" (or, since
selectors are constant here, directly @selector(foo2:)). As for the number
of exclamation marks in the ARG(H?) of yours, I am sorry, but this is
documented *VERY* explicitly.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.