class_copyPropertyList和class_copyIvarList的区别
来源:互联网 发布:单片机wifi模块传输 编辑:程序博客网 时间:2024/06/04 19:53
class_copyPropertyList:
通过类名获得类的属性变量。
class_copyIvarList
通过类名获得类的实例变量。也就是说:
class_copyPropertyList获得的是由@property修饰过的变量,
class_copyIvarList获得的是class_copyPropertyList修饰的以及在m文件的中@implementation内定义的变量
eg:
//.h
@interface Model : NSObject
@property (nonatomic,copy)NSString *sex;
@property (nonatomic,copy)NSString *name;
@property (nonatomic,assign)NSInteger age;
@property (nonatomic,strong)NSDictionary *imgCode;
@end
//.m@interface Model ()
@property (nonatomic,copy)NSString *Id;
@end
@implementation Model {
NSInteger _index;
}
@end
//使用的时候
unsigned int propertiesCount =0;
unsigned int ivarsCount =0;
objc_property_t *properties = class_copyPropertyList(Model, &propertiesCount);
Ivar *ivars = class_copyIvarList(Model, &ivarsCount);
则 propertiesCount = 5ivarsCount = 6
- class_copyPropertyList和class_copyIvarList的区别
- class_copyPropertyList与class_copyIvarList的区别
- class_copyPropertyList与class_copyIvarList区别
- iOS runtime ~ class_copyPropertyList与class_copyIvarList区别
- class_copyPropertyList与class_copyIvarList区别,获取属性,使用runtime方法的注意事项
- class_copyIvarList和class_copyMethodList
- class_copyIvarList和class_copyMethodList实例
- iOS 使用class_copyPropertyList等runtime方法的注意事项
- 运行时简单使用-->获取对象的属性(class_copyIvarList)
- IOS反射 class_copyPropertyList
- 和和的区别
- & 和 &&、|和||的区别:
- &和&&、|和||的区别
- &&和&,||和|的区别
- &和&&、|和||的区别
- &和&&、|和||的区别
- ../和./和/的区别
- &和&&,|和||的区别
- HDU 4006 The kth great number (优先队列)
- Github的repositories的文件大小限制
- Node.js中的setImmediate()与process.nextTick
- 系统提示缺少libltdl.so.3
- android 微博sdk 集成 文件不存在(8998) 您所访问的站点在新浪微博的认证失败,错误码 21322
- class_copyPropertyList和class_copyIvarList的区别
- 数据映射--B树
- ssm(spring+springMVC+mybatis)框架整合mongodb3.2.6提示Cannot resolve the name 'repository:auditing-attribut
- EmEditor 搜索历史/查找历史的删除/清空 包括在文件中查找的历史删除 文本类型的删除
- 删除空白瓦片
- win10下 mysql服务无法启动
- Creating schema using Saiku Schema Designer
- Struts1、Struts2、Hibernate、Spring框架工作原理介绍
- Effective cpp 读书笔记3