| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // UILabel+FontAppearance.m
- // RedAnt ERP Mobile
- //
- // Created by Ray on 11/20/15.
- // Copyright © 2015 United Software Applications, Inc. All rights reserved.
- //
- #import "UILabel+FontAppearance.h"
- @implementation UILabel (FontAppearance)
- - (void)setAppearanceFont:(UIFont *)font
- {
- if (self.tag == 1001) {
- return;
- }
- BOOL isBold = (self.font.fontDescriptor.symbolicTraits & UIFontDescriptorTraitBold);
- const CGFloat* colors = CGColorGetComponents(self.textColor.CGColor);
- if (self.font.pointSize == 14) {
- // set font for uialertcontroller title
- self.font = [UIFont systemFontOfSize:11];
- } else if (self.font.pointSize == 13) {
- // set font for uialertcontroller message
- self.font = [UIFont systemFontOfSize:11];
- } else if (isBold) {
- // set font for UIAlertAction with UIAlertActionStyleCancel
- self.font = [UIFont systemFontOfSize:12];
- } else if ((*colors) == 1) {
- // set font for UIAlertAction with UIAlertActionStyleDestructive
- self.font = [UIFont systemFontOfSize:13];
- } else {
- // set font for UIAlertAction with UIAlertActionStyleDefault
- self.font = [UIFont systemFontOfSize:14];
- }
- self.tag = 1001;
- }
- - (UIFont *)appearanceFont
- {
- return self.font;
- }
- @end
|