// // NSObject+AssociatedObject.m // J3Dps // // Created by hongtao on 14-6-11. // Copyright (c) 2014年 hongtao5. All rights reserved. // #import "NSObject+AssociatedObject.h" #import @implementation NSObject (AssociatedObject) - (id)objectWithAssociatedKey:(void *)key { return objc_getAssociatedObject(self, key); } - (void)setObject:(id)object forAssociatedKey:(void *)key retained:(BOOL)retain { objc_setAssociatedObject(self, key, object, retain?OBJC_ASSOCIATION_RETAIN_NONATOMIC:OBJC_ASSOCIATION_ASSIGN); } @end