获取私有变量名称
// 获取私有变量名称 + (void)getIvars { unsigned int count = 0; Ivar *ivars = class_copyIvarList([self class], &count); for (int i = 0; i < count; i++) { Ivar ivar = ivars[i]; NSLog(@"%s----%s", ivar_getName(ivar), ivar_getTypeEncoding(ivar)); } }
// 获取私有变量名称 + (void)getIvars { unsigned int count = 0; Ivar *ivars = class_copyIvarList([self class], &count); for (int i = 0; i < count; i++) { Ivar ivar = ivars[i]; NSLog(@"%s----%s", ivar_getName(ivar), ivar_getTypeEncoding(ivar)); } }