Fix poll button

This commit is contained in:
Justin Mazzocchi 2021-02-07 10:35:33 -08:00
parent b7f792a7d7
commit 483f519f4b
No known key found for this signature in database
GPG Key ID: E223E6937AAFB01C
1 changed files with 4 additions and 5 deletions

View File

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