码迷,mamicode.com
首页 >  
搜索关键字:class_copypropertylist    ( 8个结果
runtime学习笔记
获取属性objc_property_t * propertys = class_copyPropertyList(clazz, &outCount); 获取属性名NSString * key = [NSString stringWithCString:property_getName(propert
分类:其他好文   时间:2016-03-21 12:10:39    阅读次数:126
ObjC 利用反射和KVC实现嵌套对象序列化成JSON数据
原理:0.创建一个新的可变字典:NSMutableDictionary1.采用class_copyPropertyList函数遍历对象的属性2.property_getName获取属性名,valueForKey获取属性内容。3.判断该属性内容的Class:(1)假如为基础类型(NSString,NS...
分类:Web程序   时间:2015-12-29 14:39:06    阅读次数:189
class_copyIvarList和class_copyPropertyList的区别
class_copyPropertyList返回的仅仅是对象类的属性(@property申明的属性),而class_copyIvarList返回类的所有属性和变量(包括在@interface大括号中声明的变量) -->> { NSString *name; }
分类:其他好文   时间:2015-09-23 14:41:23    阅读次数:957
通过OC运行时(runtime)获得类的属性列表
最近一段时间在研究OC的运行时机制,碰到一个叫property_getAttributes函数,再此对其用法进行简单的总结。property_getAttributes主要用于获取一个类的property即该property的属性数据,也叫metadata(元数据),涉及到得运行时函数包括class_copyPropertyList,property_getN..
分类:其他好文   时间:2015-08-12 14:52:26    阅读次数:129
model转字典
+(NSDictionary*)entityToDictionary:(id)entity{Classclazz=[entityclass];u_intcount;objc_property_t*properties=class_copyPropertyList(clazz,&count);NSMutableArray*propertyArray=[NSMutableArrayarrayWithCapacity:count];NSMutableArray*valueArray=[NSMutableAr..
分类:其他好文   时间:2015-07-01 06:24:28    阅读次数:111
swift 获取属性列表 class_copyPropertyList
在当前类中 调用这个方法 -- 就可以获取 这个类中所定义的属性 -func getPropertieNames(){ var outCount:UInt32 outCount = 0 var peopers:UnsafeMutablePointer! = class_cop...
分类:编程语言   时间:2015-06-18 08:10:27    阅读次数:193
iOS 反射获取类的属性列表
// 获取对象所有属性:- (NSArray*)propertyKeys{ unsigned int outCount, i; objc_property_t *properties = class_copyPropertyList([self class], &outCount); ...
分类:移动开发   时间:2014-12-18 10:08:34    阅读次数:150
ios开发 Reflection(三) 利用反射自动绑值
反射的具体应用,自动绑值获取属性列表 1 - (NSArray*)propertyKeys 2 { 3 unsigned int outCount, i; 4 objc_property_t *properties = class_copyPropertyList([self cla...
分类:移动开发   时间:2014-10-31 18:42:27    阅读次数:335
8条  
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!