• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSObjet respondsToSelector:method does not work when the method has arguments.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: how to get a file's long name?
  • Next by Date: Re: autorelease pools in new threads
  • Previous by thread: Re: NSObjet respondsToSelector:method does not work when the method has arguments.
  • Next by thread: How to connect to menu items from another Nib?
  • Index(es):
    • Date
    • Thread