diff --git a/Tusker/Views/Poll/PollVoteButton.swift b/Tusker/Views/Poll/PollVoteButton.swift index 96fa4f61..60d289c8 100644 --- a/Tusker/Views/Poll/PollVoteButton.swift +++ b/Tusker/Views/Poll/PollVoteButton.swift @@ -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 diff --git a/Tusker/Views/Poll/StatusPollView.swift b/Tusker/Views/Poll/StatusPollView.swift index d1fcabb0..73d98c08 100644 --- a/Tusker/Views/Poll/StatusPollView.swift +++ b/Tusker/Views/Poll/StatusPollView.swift @@ -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 }