From 1e691a2a762f1b2921dc7a92f4576eda9ad0b121 Mon Sep 17 00:00:00 2001 From: CMK Date: Wed, 3 Mar 2021 12:46:38 +0800 Subject: [PATCH] fix: AutoLayout warning for poll UI --- Mastodon/Diffiable/Section/PollSection.swift | 2 ++ Mastodon/Scene/Share/View/Content/StatusView.swift | 4 ++++ .../Share/View/TableviewCell/PollOptionTableViewCell.swift | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Mastodon/Diffiable/Section/PollSection.swift b/Mastodon/Diffiable/Section/PollSection.swift index b48231dbf..08f1f8710 100644 --- a/Mastodon/Diffiable/Section/PollSection.swift +++ b/Mastodon/Diffiable/Section/PollSection.swift @@ -39,5 +39,7 @@ extension PollSection { itemAttribute: PollItem.Attribute ) { cell.optionLabel.text = pollOption.title + cell.configureCheckmark(state: itemAttribute.voted ? .on : .off) + } } diff --git a/Mastodon/Scene/Share/View/Content/StatusView.swift b/Mastodon/Scene/Share/View/Content/StatusView.swift index 702d9c7e4..55f785ca3 100644 --- a/Mastodon/Scene/Share/View/Content/StatusView.swift +++ b/Mastodon/Scene/Share/View/Content/StatusView.swift @@ -276,6 +276,7 @@ extension StatusView { activeTextLabel.trailingAnchor.constraint(equalTo: statusTextContainerView.trailingAnchor), statusTextContainerView.bottomAnchor.constraint(greaterThanOrEqualTo: activeTextLabel.bottomAnchor), ]) + activeTextLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical) contentWarningBlurContentImageView.translatesAutoresizingMaskIntoConstraints = false statusTextContainerView.addSubview(contentWarningBlurContentImageView) NSLayoutConstraint.activate([ @@ -320,6 +321,9 @@ extension StatusView { pollStatusStackView.addArrangedSubview(pollVoteCountLabel) pollStatusStackView.addArrangedSubview(pollStatusDotLabel) pollStatusStackView.addArrangedSubview(pollCountdownLabel) + pollVoteCountLabel.setContentHuggingPriority(.defaultHigh + 2, for: .horizontal) + pollStatusDotLabel.setContentHuggingPriority(.defaultHigh + 1, for: .horizontal) + pollCountdownLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) // action toolbar container containerStackView.addArrangedSubview(actionToolbarContainer) diff --git a/Mastodon/Scene/Share/View/TableviewCell/PollOptionTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/PollOptionTableViewCell.swift index 5372380bd..eb427bc31 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/PollOptionTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/PollOptionTableViewCell.swift @@ -128,7 +128,7 @@ extension PollOptionTableViewCell { roundedBackgroundView.layer.cornerCurve = .circular checkmarkBackgroundView.layer.masksToBounds = true - checkmarkBackgroundView.layer.cornerRadius = checkmarkBackgroundView.bounds.height * 0.5 + checkmarkBackgroundView.layer.cornerRadius = PollOptionTableViewCell.checkmarkImageSize.width * 0.5 checkmarkBackgroundView.layer.cornerCurve = .circular }