| 123456789101112131415161718192021222324252627282930313233343536373839 |
- #import "BTUIKBarButtonItem.h"
- #import "BTUIKAppearance.h"
- @implementation BTUIKBarButtonItem
- - (instancetype)init {
- if (self = [super init]) {
- [self updateTitleTextAttributes];
- }
- return self;
- }
- - (void)setBold:(BOOL)bold {
- _bold = bold;
- [self updateTitleTextAttributes];
- }
- - (void)updateTitleTextAttributes {
- UIFont *font;
- if (self.bold) {
- font = [[BTUIKAppearance sharedInstance].boldFont fontWithSize:UIFont.labelFontSize];
- } else {
- font = [[BTUIKAppearance sharedInstance].font fontWithSize:UIFont.labelFontSize];
- }
- [self setTitleTextAttributes:@{NSForegroundColorAttributeName: [BTUIKAppearance sharedInstance].tintColor,
- NSFontAttributeName:font}
- forState:UIControlStateNormal];
- [self setTitleTextAttributes:@{NSForegroundColorAttributeName: [BTUIKAppearance sharedInstance].tintColor,
- NSFontAttributeName:font}
- forState:UIControlStateNormal | UIControlStateHighlighted];
- [self setTitleTextAttributes:@{NSForegroundColorAttributeName: [BTUIKAppearance sharedInstance].disabledColor,
- NSFontAttributeName:font}
- forState:UIControlStateDisabled];
- }
- @end
|