[ad_1]
I create dialog with customized button UIButton in swift IOS. How can change UIButton dimension programmatically.
class SuccessMessageView: UIView, UITextFieldDelegate {
non-public var buttonConfirm : UIButton = {
let button = UIButton()
button.setTitle("Okay", for: .regular)
button.backgroundColor = UIColor(rgb: PreferenceManager.shared.hasDevice() ? purpleColour : orangeColour)
button.setTitleColor(.white, for: .regular)
button.layer.cornerRadius = 10
button.addTarget(self, motion: #selector(confirmFunc), for: .touchDown)
button.translatesAutoresizingMaskIntoConstraints = false
button.widthAnchor.constraint(equalToConstant: 140.0).isActive = true
button.body.dimension.width = 140
return button
}
}
[ad_2]
