重写下面属性的setter、getter方法
@property (nonatomic, assign) BOOL hidden;
@property (nonatomic, strong) UIColor *backgroundColor;
#pragma mark hidden
- (void)setHidden:(BOOL)hidden {
objc_setAssociatedObject(self, @selector(hidden), @(hidden), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (BOOL)hidden {
return objc_getAssociatedObject(self, _cmd);
}
#pragma mark backgroundColor
- (void)setBackgroundColor:(UIColor *)backgroundColor {
objc_setAssociatedObject(self, @selector(backgroundColor), backgroundColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (UIColor *)backgroundColor {
return objc_getAssociatedObject(self, _cmd);
}