88
99#import " _WHDebugConsoleLabel.h"
1010
11- @implementation _WHDebugConsoleLabel {
12- UIFont *_font;
13- UIFont *_subFont;
14- }
11+ @interface _WHDebugConsoleLabel ()
12+
13+ @property (nonatomic , strong ) UIFont *mainFont;
14+ @property (nonatomic , strong ) UIFont *subFont;
15+
16+ @end
17+
18+ @implementation _WHDebugConsoleLabel
1519
1620- (instancetype )initWithFrame : (CGRect)frame {
1721 self = [super initWithFrame: frame];
@@ -24,12 +28,12 @@ - (void)setDefault {
2428 self.userInteractionEnabled = NO ;
2529 self.adjustsFontSizeToFitWidth = YES ;
2630
27- _font = [UIFont fontWithName: @" Menlo" size: 14 ];
28- if (_font ) {
29- _subFont = [UIFont fontWithName: @" Menlo" size: 4 ];
31+ self. mainFont = [UIFont fontWithName: @" Menlo" size: 14 ];
32+ if (self. mainFont ) {
33+ self. subFont = [UIFont fontWithName: @" Menlo" size: 4 ];
3034 } else {
31- _font = [UIFont fontWithName: @" Courier" size: 14 ];
32- _subFont = [UIFont fontWithName: @" Courier" size: 4 ];
35+ self. mainFont = [UIFont fontWithName: @" Courier" size: 14 ];
36+ self. subFont = [UIFont fontWithName: @" Courier" size: 4 ];
3337 }
3438}
3539
@@ -57,8 +61,8 @@ - (NSAttributedString *)fpsAttributedStringWith:(float)fps {
5761 NSMutableAttributedString *text = [[NSMutableAttributedString alloc ] initWithString: [NSString stringWithFormat: @" %d FPS" ,(int )round (fps)]];
5862 [text addAttribute: NSForegroundColorAttributeName value: color range: NSMakeRange (0 , text.length - 3 )];
5963 [text addAttribute: NSForegroundColorAttributeName value: [UIColor whiteColor ] range: NSMakeRange (text.length - 3 , 3 )];
60- [text addAttribute: NSFontAttributeName value: _font range: NSMakeRange (0 , text.length)];
61- [text addAttribute: NSFontAttributeName value: _subFont range: NSMakeRange (text.length - 4 , 1 )];
64+ [text addAttribute: NSFontAttributeName value: self .mainFont range: NSMakeRange (0 , text.length)];
65+ [text addAttribute: NSFontAttributeName value: self .subFont range: NSMakeRange (text.length - 4 , 1 )];
6266 return text;
6367}
6468
@@ -68,8 +72,8 @@ - (NSAttributedString *)memoryAttributedStringWith:(float)memory {
6872 NSMutableAttributedString *text = [[NSMutableAttributedString alloc ] initWithString: [NSString stringWithFormat: @" %.1f M" ,memory]];
6973 [text addAttribute: NSForegroundColorAttributeName value: color range: NSMakeRange (0 , text.length - 1 )];
7074 [text addAttribute: NSForegroundColorAttributeName value: [UIColor whiteColor ] range: NSMakeRange (text.length - 1 , 1 )];
71- [text addAttribute: NSFontAttributeName value: _font range: NSMakeRange (0 , text.length)];
72- [text addAttribute: NSFontAttributeName value: _subFont range: NSMakeRange (text.length - 2 , 1 )];
75+ [text addAttribute: NSFontAttributeName value: self .mainFont range: NSMakeRange (0 , text.length)];
76+ [text addAttribute: NSFontAttributeName value: self .subFont range: NSMakeRange (text.length - 2 , 1 )];
7377 return text;
7478}
7579
@@ -79,8 +83,8 @@ - (NSAttributedString *)cpuAttributedStringWith:(float)cpu {
7983 NSMutableAttributedString *text = [[NSMutableAttributedString alloc ] initWithString: [NSString stringWithFormat: @" %d%% CPU" ,(int )round (cpu)]];
8084 [text addAttribute: NSForegroundColorAttributeName value: color range: NSMakeRange (0 , text.length - 3 )];
8185 [text addAttribute: NSForegroundColorAttributeName value: [UIColor whiteColor ] range: NSMakeRange (text.length - 3 , 3 )];
82- [text addAttribute: NSFontAttributeName value: _font range: NSMakeRange (0 , text.length)];
83- [text addAttribute: NSFontAttributeName value: _subFont range: NSMakeRange (text.length - 4 , 1 )];
86+ [text addAttribute: NSFontAttributeName value: self .mainFont range: NSMakeRange (0 , text.length)];
87+ [text addAttribute: NSFontAttributeName value: self .subFont range: NSMakeRange (text.length - 4 , 1 )];
8488 return text;
8589}
8690
0 commit comments