用法
//动态创建属性
objc_setAssociatedObject(self, (__bridge const void *)(KpropertyKey), temp.copy, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
//获取动态创建的属性值
objc_getAssociatedObject(self, (__bridge const void *)(KpropertyKey));
unsigned int count = 0;
objc_property_t *properties = class_copyPropertyList(self, &count);
NSMutableArray *temp = [NSMutableArray array];
for (unsigned int i = 0; i<count; i++) {
objc_property_t property = properties[i];
const char *cStr = property_getName(property);
NSString *ocStr = [NSString stringWithCString:cStr encoding:NSUTF8StringEncoding];
[temp addObject:ocStr];
}
free(properties);//注意释放内存
//原有方法
Method old = class_getInstanceMethod(self, @selector(setImage:));
//新方法
Method new = class_getInstanceMethod(self, @selector(DD_setImage:));
//交叉方法
method_exchangeImplementations(old, new);