-
(void)initialize
{
[self getIvars];
} -
(void)getProperties
{
unsigned int count = 0;objc_property_t *properties = class_copyPropertyList([UITextField class], &count);
for (int i = 0; i<count; i++) {
// 取出属性
objc_property_t property = properties[i];// 打印属性名字 XMGLog(@"%s <----> %s", property_getName(property), property_getAttributes(property));
}
free(properties);
} -
(void)getIvars
{
unsigned int count = 0;// 拷贝出所有的成员变量列表
Ivar *ivars = class_copyIvarList([UITextField class], &count);for (int i = 0; i<count; i++) {
// 取出成员变量
// Ivar ivar = *(ivars + i);
Ivar ivar = ivars[i];// 打印成员变量名字 XMGLog(@"%s %s", ivar_getName(ivar), ivar_getTypeEncoding(ivar));
}
// 释放
free(ivars);
}Ivar *ivars = class_copyIvarList([UITextField class], &count);
for (int i = 0; i<count; i++) {
// 取出成员变量
// Ivar ivar = *(ivars + i);
Ivar ivar = ivars[i];// 打印成员变量名字 XMGLog(@"%s %s", ivar_getName(ivar), ivar_getTypeEncoding(ivar));
}
// 释放
free(ivars);
}
网友评论