Fix toasts not adjusting font for Dynamic Type
This commit is contained in:
parent
fb2c9b341c
commit
11e81acbc1
|
@ -44,6 +44,7 @@ class TimelineGapCollectionViewCell: UICollectionViewCell {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.text = "Load more"
|
label.text = "Load more"
|
||||||
label.font = .preferredFont(forTextStyle: .headline)
|
label.font = .preferredFont(forTextStyle: .headline)
|
||||||
|
label.adjustsFontForContentSizeCategory = true
|
||||||
label.textColor = .tintColor
|
label.textColor = .tintColor
|
||||||
|
|
||||||
chevronView.update(direction: .above)
|
chevronView.update(direction: .above)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Pachyderm
|
||||||
|
|
||||||
struct ToastConfiguration {
|
struct ToastConfiguration {
|
||||||
var systemImageName: String?
|
var systemImageName: String?
|
||||||
var titleFont: UIFont = .boldSystemFont(ofSize: 14)
|
var titleFont: UIFont = UIFontMetrics(forTextStyle: .body).scaledFont(for: .boldSystemFont(ofSize: 14))
|
||||||
var title: String
|
var title: String
|
||||||
var subtitle: String?
|
var subtitle: String?
|
||||||
var actionTitle: String?
|
var actionTitle: String?
|
||||||
|
|
|
@ -68,13 +68,15 @@ class ToastView: UIView {
|
||||||
titleLabel.textColor = .white
|
titleLabel.textColor = .white
|
||||||
titleLabel.font = configuration.titleFont
|
titleLabel.font = configuration.titleFont
|
||||||
titleLabel.adjustsFontSizeToFitWidth = true
|
titleLabel.adjustsFontSizeToFitWidth = true
|
||||||
|
titleLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
if let subtitle = configuration.subtitle {
|
if let subtitle = configuration.subtitle {
|
||||||
let subtitleLabel = UILabel()
|
let subtitleLabel = UILabel()
|
||||||
subtitleLabel.text = subtitle
|
subtitleLabel.text = subtitle
|
||||||
subtitleLabel.textColor = .white
|
subtitleLabel.textColor = .white
|
||||||
subtitleLabel.numberOfLines = 0
|
subtitleLabel.numberOfLines = 0
|
||||||
subtitleLabel.font = .systemFont(ofSize: 14)
|
subtitleLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14))
|
||||||
|
subtitleLabel.adjustsFontForContentSizeCategory = true
|
||||||
let vStack = UIStackView(arrangedSubviews: [
|
let vStack = UIStackView(arrangedSubviews: [
|
||||||
titleLabel,
|
titleLabel,
|
||||||
subtitleLabel
|
subtitleLabel
|
||||||
|
@ -89,7 +91,8 @@ class ToastView: UIView {
|
||||||
if let actionTitle = configuration.actionTitle {
|
if let actionTitle = configuration.actionTitle {
|
||||||
let actionLabel = UILabel()
|
let actionLabel = UILabel()
|
||||||
actionLabel.text = actionTitle
|
actionLabel.text = actionTitle
|
||||||
actionLabel.font = .boldSystemFont(ofSize: 16)
|
actionLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .boldSystemFont(ofSize: 16))
|
||||||
|
actionLabel.adjustsFontForContentSizeCategory = true
|
||||||
actionLabel.textColor = .white
|
actionLabel.textColor = .white
|
||||||
stack.addArrangedSubview(actionLabel)
|
stack.addArrangedSubview(actionLabel)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue