Issue #373
UIButton.contentEdgeInsets does not play well with Auto Layout, we need to use intrinsicContentSize
final class InsetButton: UIButton {
    required init(text: String) {
        super.init(frame: .zero)
        titleLabel?.textColor = .white
        setTitle(text, for: .normal)
        layer.cornerRadius = 15
        layer.masksToBounds = true
        backgroundColor = .black
        isUserInteractionEnabled = false
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError()
    }
    override var intrinsicContentSize: CGSize {
        let size = super.intrinsicContentSize
        return CGSize(width: size.width + 24, height: size.height)
    }
}
Start the conversation