浏览代码

set medium weight again for ContactCell title

cyberta 5 年之前
父节点
当前提交
4e67371301
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 10 0
      deltachat-ios/Extensions/Extensions.swift
  2. 1 1
      deltachat-ios/View/ContactCell.swift

+ 10 - 0
deltachat-ios/Extensions/Extensions.swift

@@ -84,3 +84,13 @@ extension UITableView {
         }
     }
 }
+
+extension UIFont {
+    static func preferredFont(for style: TextStyle, weight: Weight) -> UIFont {
+        let traits = UITraitCollection(preferredContentSizeCategory: .large)
+        let desc = UIFontDescriptor.preferredFontDescriptor(withTextStyle: style, compatibleWith: traits)
+        let font = UIFont.systemFont(ofSize: desc.pointSize, weight: weight)
+        let metrics = UIFontMetrics(forTextStyle: style)
+        return metrics.scaledFont(for: font)
+    }
+}

+ 1 - 1
deltachat-ios/View/ContactCell.swift

@@ -52,7 +52,7 @@ class ContactCell: UITableViewCell {
         label.lineBreakMode = .byTruncatingTail
         label.textColor = DcColors.defaultTextColor
         label.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1), for: NSLayoutConstraint.Axis.horizontal)
-        label.font = UIFont.preferredFont(forTextStyle: .body)
+        label.font = UIFont.preferredFont(for: .body, weight: .medium)
         label.adjustsFontForContentSizeCategory = true
         return label
     }()