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) -}