Re: How to get a Category method?
Re: How to get a Category method?
- Subject: Re: How to get a Category method?
- From: Rosyna <email@hidden>
- Date: Sun, 14 Mar 2004 17:38:13 -0700
Indeed. I was not trying it on an actual instance of the class. My bad.
But even given that to stupidity on my part. How do I get the IMP (or
Method) of that selector?
I have a category on NSMenu that for a selector isKindOfSortOfLikeThisMenuHere:
but if I call class_getInstanceMethod(NSClassFromString(@"NSMenu"),
NSSelectorFromString(@"isKindOfSortOfLikeThisMenuHere:") it returns
NULL. Am I also missing something rather obvious here?
However, if I call
class_getInstanceMethod(NSClassFromString(@"NSMenu"),
NSSelectorFromString(@"setTitle:") it returns the correct Method.
Ack, at 3/15/04, Ondra Cada said:
Rosyna,
On Monday, Mar 15, 2004, at 01:17 Europe/Prague, Rosyna wrote:
Try the same thing with an instance method, not a class method.
No problem. Did you?
24 /tmp> <q.m
#import <Foundation/Foundation.h>
int main() {
[NSAutoreleasePool new];
NSLog(@"responds: %d",[@""
respondsToSelector:NSSelectorFromString(@"justATest")]);
return 0;
}
@implementation NSString (JustATest)
-(void)justATest {}
@end
25 /tmp> cc -Wall -framework Foundation q.m && ./a.out
2004-03-15 01:22:36.508 a.out[23785] responds: 1
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
_______________________________________________
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.