Change master feed list to use preferred fonts.

This commit is contained in:
Maurice Parker
2019-04-27 09:49:26 -05:00
parent b62565f651
commit 7127f9a911
5 changed files with 45 additions and 12 deletions

View File

@@ -86,9 +86,11 @@ class MasterFeedTableViewCell : UITableViewCell {
private let titleView: UILabel = {
let label = NonIntrinsicLabel()
label.numberOfLines = 1
label.numberOfLines = 0
label.lineBreakMode = .byTruncatingTail
label.allowsDefaultTighteningForTruncation = false
label.adjustsFontForContentSizeCategory = true
label.font = .preferredFont(forTextStyle: .body)
return label
}()

View File

@@ -55,11 +55,12 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
}
private let titleView: UILabel = {
let label = UILabel()
label.font = UIFont.boldSystemFont(ofSize: 17.0)
label.numberOfLines = 1
let label = NonIntrinsicLabel()
label.numberOfLines = 0
label.lineBreakMode = .byTruncatingTail
label.allowsDefaultTighteningForTruncation = false
label.adjustsFontForContentSizeCategory = true
label.font = .preferredFont(forTextStyle: .body)
return label
}()

View File

@@ -8,16 +8,16 @@
import UIKit
private let padding = UIEdgeInsets(top: 1.0, left: 7.0, bottom: 1.0, right: 7.0)
private let cornerRadius = 8.0
private let bgColor = UIColor.darkGray
private let textColor = UIColor.white
private let textFont = UIFont.systemFont(ofSize: 11.0, weight: UIFont.Weight.semibold)
private var textAttributes: [NSAttributedString.Key: AnyObject] = [NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.font: textFont, NSAttributedString.Key.kern: NSNull()]
private var textSizeCache = [Int: CGSize]()
class MasterFeedUnreadCountView : UIView {
private let padding = UIEdgeInsets(top: 1.0, left: 7.0, bottom: 1.0, right: 7.0)
private let cornerRadius = 8.0
private let bgColor = UIColor.darkGray
private let textColor = UIColor.white
private let textFont = UIFont.preferredFont(forTextStyle: .caption1)
private lazy var textAttributes: [NSAttributedString.Key: AnyObject] = [NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.font: textFont, NSAttributedString.Key.kern: NSNull()]
private var textSizeCache = [Int: CGSize]()
var unreadCount = 0 {
didSet {
invalidateIntrinsicContentSize()