// // RABadgeButton.m // Apex And Drivers // // Created by Jack on 2018/11/2. // Copyright © 2018年 USAI. All rights reserved. // #import "RABadgeButton.h" @interface RABadgeButton () @property (nonatomic,strong) IBOutlet UILabel *numberLabel; @property (nonatomic,strong) IBOutlet UIButton *itemButton; @end @implementation RABadgeButton + (instancetype)badgeButton { RABadgeButton *btn = [[[NSBundle mainBundle] loadNibNamed:@"badge_button" owner:nil options:nil] objectAtIndex:0]; return btn; } - (void)awakeFromNib { [super awakeFromNib]; self.numberLabel.text = nil; self.numberLabel.backgroundColor = UIColorFromRGB(0x299D4D); self.numberLabel.layer.cornerRadius = 7.5f; self.numberLabel.layer.masksToBounds = YES; } - (void)setImage:(UIImage *)image forState:(UIControlState)state { [self.itemButton setImage:image forState:state]; } - (void)setTintColor:(UIColor *)tintColor { [self.itemButton setTintColor:tintColor]; } - (void)setNumber:(NSUInteger)number { self.numberLabel.text = [NSString stringWithFormat:@"%lu",(unsigned long)number]; } - (void)setNumberColor:(UIColor *)color { self.numberLabel.textColor = color; } - (void)setNumberBackgroundColor:(UIColor *)color { self.numberLabel.backgroundColor = color; } - (IBAction)itemButtonClick:(id)sender { } @end