@IBOutlet weak var catParentIdButton: UIButton!
I have this code and now I want to write the button label programmatically.
What will be the syntax to write the label of the button in swift 3.0?
Method Signature changed in Swift 3.0
func setTitle(_ title: String?,
for state: UIControlState) // Use this method to set the title for the button
example:
btn.setTitle(title: "Title", for: .normal)
Note default state of a btn control is changed to .Normal
to .normal
.
// previous
public static var Normal: UIControlState { get }
// Swift 3.0
static var normal: UIControlState { get }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With