To be referenced:
# Import <Foundation/nsobjcruntime. h>
# Import <objc/runtime. h>
Implementation
Class currentclass = [common class];
While (currentclass ){
Unsigned int methodcount;
Method * methodlist = class_copymethodlist (currentclass, & methodcount );
Unsigned int I = 0;
For (; I <methodcount; I ++ ){
Nslog (@ "% @-% @", [nsstring stringwithcstring: class_getname (currentclass) encoding: nsutf8stringencoding], [nsstring stringwithcstring: sel_getname (method_getname (methodlist [I])
Encoding: nsutf8stringencoding]);
}
Free (methodlist );
Currentclass = class_getsuperclass (currentclass );
}
(Smking: I tried it. It is indeed feasible, and in objc/runtime. h. Search for class_copymethodlist in the help document. You can see a considerable number of runtime methods. You can also find a way to replace existing classes. In the runtime process, this allows you to intercept events, you can traverse the methods of this class and then replace a special method to invalidate the purpose .)
From: http://blog.sina.com.cn/s/blog_6d01cce30101e4ab.html