mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Change master feed list to use preferred fonts.
This commit is contained in:
26
iOS/Extensions/UIFont-Extensions.swift
Normal file
26
iOS/Extensions/UIFont-Extensions.swift
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// UIFont-Extensions.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 4/27/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIFont {
|
||||
|
||||
func withTraits(traits:UIFontDescriptor.SymbolicTraits) -> UIFont {
|
||||
let descriptor = fontDescriptor.withSymbolicTraits(traits)
|
||||
return UIFont(descriptor: descriptor!, size: 0) //size 0 means keep the size as it is
|
||||
}
|
||||
|
||||
func bold() -> UIFont {
|
||||
return withTraits(traits: .traitBold)
|
||||
}
|
||||
|
||||
func italic() -> UIFont {
|
||||
return withTraits(traits: .traitItalic)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}()
|
||||
|
||||
|
||||
@@ -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
|
||||
}()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user