fix: AutoLayout warning for poll UI

This commit is contained in:
CMK 2021-03-03 12:46:38 +08:00
parent 376cb3d58a
commit 1e691a2a76
3 changed files with 7 additions and 1 deletions

View File

@ -39,5 +39,7 @@ extension PollSection {
itemAttribute: PollItem.Attribute itemAttribute: PollItem.Attribute
) { ) {
cell.optionLabel.text = pollOption.title cell.optionLabel.text = pollOption.title
cell.configureCheckmark(state: itemAttribute.voted ? .on : .off)
} }
} }

View File

@ -276,6 +276,7 @@ extension StatusView {
activeTextLabel.trailingAnchor.constraint(equalTo: statusTextContainerView.trailingAnchor), activeTextLabel.trailingAnchor.constraint(equalTo: statusTextContainerView.trailingAnchor),
statusTextContainerView.bottomAnchor.constraint(greaterThanOrEqualTo: activeTextLabel.bottomAnchor), statusTextContainerView.bottomAnchor.constraint(greaterThanOrEqualTo: activeTextLabel.bottomAnchor),
]) ])
activeTextLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
contentWarningBlurContentImageView.translatesAutoresizingMaskIntoConstraints = false contentWarningBlurContentImageView.translatesAutoresizingMaskIntoConstraints = false
statusTextContainerView.addSubview(contentWarningBlurContentImageView) statusTextContainerView.addSubview(contentWarningBlurContentImageView)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
@ -320,6 +321,9 @@ extension StatusView {
pollStatusStackView.addArrangedSubview(pollVoteCountLabel) pollStatusStackView.addArrangedSubview(pollVoteCountLabel)
pollStatusStackView.addArrangedSubview(pollStatusDotLabel) pollStatusStackView.addArrangedSubview(pollStatusDotLabel)
pollStatusStackView.addArrangedSubview(pollCountdownLabel) pollStatusStackView.addArrangedSubview(pollCountdownLabel)
pollVoteCountLabel.setContentHuggingPriority(.defaultHigh + 2, for: .horizontal)
pollStatusDotLabel.setContentHuggingPriority(.defaultHigh + 1, for: .horizontal)
pollCountdownLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
// action toolbar container // action toolbar container
containerStackView.addArrangedSubview(actionToolbarContainer) containerStackView.addArrangedSubview(actionToolbarContainer)

View File

@ -128,7 +128,7 @@ extension PollOptionTableViewCell {
roundedBackgroundView.layer.cornerCurve = .circular roundedBackgroundView.layer.cornerCurve = .circular
checkmarkBackgroundView.layer.masksToBounds = true checkmarkBackgroundView.layer.masksToBounds = true
checkmarkBackgroundView.layer.cornerRadius = checkmarkBackgroundView.bounds.height * 0.5 checkmarkBackgroundView.layer.cornerRadius = PollOptionTableViewCell.checkmarkImageSize.width * 0.5
checkmarkBackgroundView.layer.cornerCurve = .circular checkmarkBackgroundView.layer.cornerCurve = .circular
} }