iOS----------Runtime 获取属性列表 方法列表
导入
#import <objc/runtime.h>
unsigned int count;
method *methods = class_copymethodlist([uialertaction class], &count);
for (int i = 0; i < count; i++) {
method method = methods[i];
sel selector = method_getname(method);
nsstring *name = nsstringfromselector(selector);
nslog(@"method_getname:%@",name);
}
unsigned int numivars;
ivar *vars = class_copyivarlist([uialertaction class], &numivars);
nsstring *key=nil;
for(int i = 0; i < numivars; i++) {
ivar thisivar = vars[i];
key = [nsstring stringwithutf8string:ivar_getname(thisivar)];
nslog(@"variable_name :%@", key);
}
free(vars);
上一篇: Redis我想入门——数据类型
下一篇: 为啥这么大度