Re: Listing all selectors for an object
Re: Listing all selectors for an object
- Subject: Re: Listing all selectors for an object
- From: "Adam R. Maxwell" <email@hidden>
- Date: Sun, 5 Mar 2006 10:37:44 -0800
On Mar 5, 2006, at 10:16, Philippe Robin wrote:
Hello,
Is there a way to list all the selectors a given object can respond
to?
I've used a class method like this:
+ (void)printSelectorList:(id)anObject;
{
int k = 0;
void *iterator = 0;
struct objc_method_list *mlist;
NSString *className = [[anObject class] description];
while( mlist = class_nextMethodList( [anObject class],
&iterator ) ){
for(k=0; k<mlist->method_count; k++){
NSLog(@"%@ implements %s", className, mlist->method_list
[k].method_name);
}
}
}
Depending on how early you call it, the list may vary.
--
Adam
_______________________________________________
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