How to set button shortcut in swift 3?

@IBOutlet weak var catParentIdButton: UIButton! 

I have this code, and now I want to write a program label programmatically.
What will be the syntax for writing a button label in swift 3.0?

+6
source share
1 answer

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 The default state for btn control is changed from .Normal to .Normal .

 // previous public static var Normal: UIControlState { get } // Swift 3.0 static var normal: UIControlState { get } 
+13
source

All Articles