Fix ambiguous constraints in poll view
This commit is contained in:
parent
13a807ba4f
commit
d9a6bb0fd2
|
@ -32,10 +32,12 @@ class PollVoteButton: UIView {
|
|||
|
||||
button.translatesAutoresizingMaskIntoConstraints = false
|
||||
button.setTitleColor(.secondaryLabel, for: .disabled)
|
||||
button.contentHorizontalAlignment = .trailing
|
||||
embedSubview(button)
|
||||
#if targetEnvironment(macCatalyst)
|
||||
label.textColor = .secondaryLabel
|
||||
label.translatesAutoresizingMaskIntoConstraints = false
|
||||
label.textAlignment = .right
|
||||
embedSubview(label)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ class StatusPollView: UIView, StatusContentPollView {
|
|||
voteButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
voteButton.addTarget(self, action: #selector(votePressed))
|
||||
voteButton.setFont(infoLabel.font)
|
||||
voteButton.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
||||
addSubview(voteButton)
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
|
@ -77,7 +78,7 @@ class StatusPollView: UIView, StatusContentPollView {
|
|||
infoLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
infoLabel.topAnchor.constraint(equalTo: optionsView.bottomAnchor),
|
||||
infoLabel.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
infoLabel.trailingAnchor.constraint(lessThanOrEqualTo: voteButton.leadingAnchor, constant: -8),
|
||||
infoLabel.trailingAnchor.constraint(equalTo: voteButton.leadingAnchor, constant: -8),
|
||||
|
||||
voteButton.widthAnchor.constraint(greaterThanOrEqualToConstant: 44),
|
||||
voteButton.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
|
@ -141,7 +142,7 @@ class StatusPollView: UIView, StatusContentPollView {
|
|||
}
|
||||
|
||||
func estimateHeight(effectiveWidth: CGFloat) -> CGFloat {
|
||||
guard let poll else { return 0 }
|
||||
guard poll != nil else { return 0 }
|
||||
return optionsView.estimateHeight(effectiveWidth: effectiveWidth) + infoLabel.sizeThatFits(UIView.layoutFittingExpandedSize).height
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue