开发者

How to enumerate methods of a class

开发者 https://www.devze.com 2023-03-11 21:08 出处:网络
Is there any way to enumerate methods of one class, for example, I have one class defined like below:

Is there any way to enumerate methods of one class, for example, I have one class defined like below:

@class Foo : NSObject
    -(void)doStuff1;
    -(void)doStuff2;
@end

And I was wondering if there is any way let me access the method "doStuff1" and "doStuff2" with en开发者_开发问答umerate methods, even before I know the class has two methods.

I know the method [foo performSelector:@selector(doSutff1)] but this is not I want.

Pls any guy tell me the way, thx so much.


You use the runtime library...

class_copyMethodList

Check the Apple docs here

0

精彩评论

暂无评论...
验证码 换一张
取 消