From 483f519f4b2b028a034a9c9b47d294fcfd17e7d6 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Sun, 7 Feb 2021 10:35:33 -0800 Subject: [PATCH] Fix poll button --- Views/UIKit/PollOptionButton.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Views/UIKit/PollOptionButton.swift b/Views/UIKit/PollOptionButton.swift index 2430cc0..8d663b6 100644 --- a/Views/UIKit/PollOptionButton.swift +++ b/Views/UIKit/PollOptionButton.swift @@ -12,7 +12,6 @@ final class PollOptionButton: UIButton { titleLabel?.numberOfLines = 0 titleLabel?.lineBreakMode = .byWordWrapping contentHorizontalAlignment = .leading - titleEdgeInsets = Self.titleEdgeInsets let attributedTitle = NSMutableAttributedString(string: title) @@ -32,6 +31,10 @@ final class PollOptionButton: UIButton { setContentCompressionResistancePriority(.required, for: .vertical) + imageView?.translatesAutoresizingMaskIntoConstraints = false + imageView?.widthAnchor.constraint(greaterThanOrEqualToConstant: .minimumButtonDimension).isActive = true + imageView?.contentMode = .scaleAspectFit + heightAnchor.constraint(equalTo: titleLabel!.heightAnchor).isActive = true } @@ -46,7 +49,3 @@ extension PollOptionButton { title.height(width: width, font: .preferredFont(forTextStyle: .callout)) } } - -private extension PollOptionButton { - static let titleEdgeInsets = UIEdgeInsets(top: 0, left: .defaultSpacing, bottom: 0, right: .compactSpacing) -}