Parcourir la source

Fix FLEXCodeFontCell and use system monospace font

Tanner Bennett il y a 6 ans
Parent
commit
c44b251413

+ 2 - 2
Classes/ObjectExplorers/Views/FLEXCodeFontCell.h

@@ -6,11 +6,11 @@
 //  Copyright © 2019 Flipboard. All rights reserved.
 //  Copyright © 2019 Flipboard. All rights reserved.
 //
 //
 
 
-#import "FLEXSubtitleTableViewCell.h"
+#import "FLEXMultilineTableViewCell.h"
 
 
 NS_ASSUME_NONNULL_BEGIN
 NS_ASSUME_NONNULL_BEGIN
 
 
-@interface FLEXCodeFontCell : FLEXSubtitleTableViewCell
+@interface FLEXCodeFontCell : FLEXMultilineDetailTableViewCell
 
 
 @end
 @end
 
 

+ 1 - 2
Classes/ObjectExplorers/Views/FLEXCodeFontCell.m

@@ -15,8 +15,7 @@
     [super postInit];
     [super postInit];
     
     
     self.titleLabel.font = UIFont.flex_codeFont;
     self.titleLabel.font = UIFont.flex_codeFont;
-    self.subtitleLabel.font = UIFont.flex_smallCodeFont;
-    self.subtitleLabel.alpha = 0.5;
+    self.subtitleLabel.font = UIFont.flex_codeFont;
     self.subtitleLabel.adjustsFontSizeToFitWidth = YES;
     self.subtitleLabel.adjustsFontSizeToFitWidth = YES;
 }
 }
 
 

+ 13 - 3
Classes/Utility/Categories/UIFont+FLEX.m

@@ -8,6 +8,8 @@
 
 
 #import "UIFont+FLEX.h"
 #import "UIFont+FLEX.h"
 
 
+#define kFLEXDefaultCellFontSize 12.0
+
 @implementation UIFont (FLEX)
 @implementation UIFont (FLEX)
 
 
 + (UIFont *)flex_defaultTableCellFont
 + (UIFont *)flex_defaultTableCellFont
@@ -15,18 +17,26 @@
     static UIFont *defaultTableCellFont = nil;
     static UIFont *defaultTableCellFont = nil;
     static dispatch_once_t onceToken;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
     dispatch_once(&onceToken, ^{
-        defaultTableCellFont = [UIFont systemFontOfSize:12.0];
+        defaultTableCellFont = [UIFont systemFontOfSize:kFLEXDefaultCellFontSize];
     });
     });
 
 
     return defaultTableCellFont;
     return defaultTableCellFont;
 }
 }
 
 
 + (UIFont *)flex_codeFont {
 + (UIFont *)flex_codeFont {
-    return [self fontWithName:@"Menlo-Regular" size:self.systemFontSize];
+    if (@available(iOS 12, *)) {
+        return [self monospacedSystemFontOfSize:kFLEXDefaultCellFontSize weight:UIFontWeightRegular];
+    } else {
+        return [self fontWithName:@"Menlo-Regular" size:kFLEXDefaultCellFontSize];
+    }
 }
 }
 
 
 + (UIFont *)flex_smallCodeFont {
 + (UIFont *)flex_smallCodeFont {
-    return [self fontWithName:@"Menlo-Regular" size:self.smallSystemFontSize];
+    if (@available(iOS 12, *)) {
+        return [self monospacedSystemFontOfSize:self.smallSystemFontSize weight:UIFontWeightRegular];
+    } else {
+        return [self fontWithName:@"Menlo-Regular" size:self.smallSystemFontSize];
+    }
 }
 }
 
 
 @end
 @end