创建一个 UIButton 的子类,重写其方法:
- (void)drawRect:(CGRect)rect { [[self layer] setCornerRadius:CORNER_RADIUS]; [[self layer] setMasksToBounds:YES]; [[self layer] setBorderWidth:1]; [[self layer] setBorderColor:self.tintColor.CGColor]; [self.imageView setTintColor:self.tintColor]; } - (void)tintColorDidChange { [super tintColorDidChange]; [self setNeedsDisplay]; // [[self layer] setBorderColor:self.tintColor.CGColor]; }