获取类中所有属性

    u_int               count;

    objc_property_t*    properties= class_copyPropertyList([person class], &count);

    for (int i = 0; i < count ; i++)

    {

        const char* propertyName = property_getName(properties[i]);

        NSString *strName = [NSString  stringWithCString:propertyName encoding:NSUTF8StringEncoding];

        NSLog(@"%@",strName);

    }

 

posted @ 2015-03-27 15:25  lanacon  Views(261)  Comments(0Edit  收藏  举报