fix: some label trimmed under zoomed display mode issue
This commit is contained in:
parent
9a8653f39c
commit
7806816213
|
@ -78,12 +78,14 @@ extension NotificationSection {
|
||||||
}
|
}
|
||||||
let createAt = notification.createAt
|
let createAt = notification.createAt
|
||||||
let actionText = notification.notificationType.actionText
|
let actionText = notification.notificationType.actionText
|
||||||
cell.actionLabel.text = actionText + " · " + createAt.timeAgoSinceNow
|
cell.actionLabel.text = actionText
|
||||||
|
cell.timestampLabel.text = createAt.timeAgoSinceNow
|
||||||
AppContext.shared.timestampUpdatePublisher
|
AppContext.shared.timestampUpdatePublisher
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak cell] _ in
|
.sink { [weak cell] _ in
|
||||||
guard let cell = cell else { return }
|
guard let cell = cell else { return }
|
||||||
cell.actionLabel.text = actionText + " · " + createAt.timeAgoSinceNow
|
cell.actionLabel.text = actionText
|
||||||
|
cell.timestampLabel.text = createAt.timeAgoSinceNow
|
||||||
}
|
}
|
||||||
.store(in: &cell.disposeBag)
|
.store(in: &cell.disposeBag)
|
||||||
|
|
||||||
|
|
|
@ -67,3 +67,9 @@ extension UIView {
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension UIView {
|
||||||
|
static var isZoomedMode: Bool {
|
||||||
|
return UIScreen.main.scale != UIScreen.main.nativeScale
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,19 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell {
|
||||||
label.lineBreakMode = .byTruncatingTail
|
label.lineBreakMode = .byTruncatingTail
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
let dotLabel: UILabel = {
|
||||||
|
let label = UILabel()
|
||||||
|
label.textColor = Asset.Colors.Label.secondary.color
|
||||||
|
label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .regular), maximumPointSize: 20)
|
||||||
|
label.text = "·"
|
||||||
|
return label
|
||||||
|
}()
|
||||||
|
let timestampLabel: UILabel = {
|
||||||
|
let label = UILabel()
|
||||||
|
label.textColor = Asset.Colors.Label.secondary.color
|
||||||
|
label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .regular), maximumPointSize: 20)
|
||||||
|
return label
|
||||||
|
}()
|
||||||
|
|
||||||
let nameLabel = MetaLabel(style: .notificationName)
|
let nameLabel = MetaLabel(style: .notificationName)
|
||||||
|
|
||||||
|
@ -170,11 +183,20 @@ extension NotificationStatusTableViewCell {
|
||||||
|
|
||||||
actionStackView.addArrangedSubview(nameLabel)
|
actionStackView.addArrangedSubview(nameLabel)
|
||||||
actionStackView.addArrangedSubview(actionLabel)
|
actionStackView.addArrangedSubview(actionLabel)
|
||||||
nameLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
|
actionStackView.addArrangedSubview(dotLabel)
|
||||||
|
actionStackView.addArrangedSubview(timestampLabel)
|
||||||
|
let timestampPaddingView = UIView()
|
||||||
|
actionStackView.addArrangedSubview(timestampPaddingView)
|
||||||
|
nameLabel.setContentHuggingPriority(.required - 3, for: .horizontal)
|
||||||
nameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
nameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||||
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
|
nameLabel.setContentCompressionResistancePriority(.required - 3, for: .horizontal)
|
||||||
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
|
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
|
||||||
actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||||
|
dotLabel.setContentHuggingPriority(.required - 2, for: .horizontal)
|
||||||
|
dotLabel.setContentCompressionResistancePriority(.required - 2, for: .horizontal)
|
||||||
|
timestampLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
|
||||||
|
timestampLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
|
||||||
|
timestampPaddingView.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||||
|
|
||||||
// follow request
|
// follow request
|
||||||
contentStackView.addArrangedSubview(buttonStackView)
|
contentStackView.addArrangedSubview(buttonStackView)
|
||||||
|
|
|
@ -29,6 +29,10 @@ final class ProfileStatusDashboardMeterView: UIView {
|
||||||
label.textColor = Asset.Colors.Label.primary.color
|
label.textColor = Asset.Colors.Label.primary.color
|
||||||
label.text = L10n.Scene.Profile.Dashboard.posts
|
label.text = L10n.Scene.Profile.Dashboard.posts
|
||||||
label.textAlignment = .center
|
label.textAlignment = .center
|
||||||
|
if UIView.isZoomedMode {
|
||||||
|
label.adjustsFontSizeToFitWidth = true
|
||||||
|
label.minimumScaleFactor = 0.8
|
||||||
|
}
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ extension ProfileStatusDashboardView {
|
||||||
containerStackView.heightAnchor.constraint(equalToConstant: 44).priority(.defaultHigh),
|
containerStackView.heightAnchor.constraint(equalToConstant: 44).priority(.defaultHigh),
|
||||||
])
|
])
|
||||||
|
|
||||||
let spacing: CGFloat = 16
|
let spacing: CGFloat = UIView.isZoomedMode ? 4 : 16
|
||||||
containerStackView.spacing = spacing
|
containerStackView.spacing = spacing
|
||||||
containerStackView.axis = .horizontal
|
containerStackView.axis = .horizontal
|
||||||
containerStackView.distribution = .fillEqually
|
containerStackView.distribution = .fillEqually
|
||||||
|
|
|
@ -29,6 +29,8 @@ class SearchRecommendCollectionHeader: UIView {
|
||||||
let button = HighlightDimmableButton(type: .custom)
|
let button = HighlightDimmableButton(type: .custom)
|
||||||
button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal)
|
button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal)
|
||||||
button.setTitle(L10n.Scene.Search.Recommend.buttonText, for: .normal)
|
button.setTitle(L10n.Scene.Search.Recommend.buttonText, for: .normal)
|
||||||
|
button.titleLabel?.adjustsFontSizeToFitWidth = true
|
||||||
|
button.titleLabel?.minimumScaleFactor = 0.8
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ class SettingsToggleTableViewCell: UITableViewCell {
|
||||||
private func setupUI() {
|
private func setupUI() {
|
||||||
selectionStyle = .none
|
selectionStyle = .none
|
||||||
accessoryView = switchButton
|
accessoryView = switchButton
|
||||||
|
textLabel?.numberOfLines = 0
|
||||||
|
|
||||||
switchButton.addTarget(self, action: #selector(switchValueDidChange(sender:)), for: .valueChanged)
|
switchButton.addTarget(self, action: #selector(switchValueDidChange(sender:)), for: .valueChanged)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue