标签:
-(UIImageView *)btnImageView
{
// return objc_getAssociatedObject(self, @selector(isClicked));
return objc_getAssociatedObject(self, &kbtnImageView);
}
//set
static char kbtnImageView;
-(void)setBtnImageView:(UIImageView *)btnImageView
{
//如果是指针类型
return objc_setAssociatedObject(self, &kbtnImageView, btnImageView, OBJC_ASSOCIATION_RETAIN);
//1 源对象self
//2 关键字 唯一静态变量key isClicked
//3 关联的对象
//4 关键策略 OBJC_ASSOCIATION_RETAIN_NONATOMIC
//objc_setAssociatedObject(self, @selector(isClicked), @(isClicked), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
标签:
原文地址:http://www.cnblogs.com/yaoyao0110/p/5640395.html