2016-10-17 45 views

回答

13

方法签名在夫特3.0改变

func setTitle(_ title: String?, 
     for state: UIControlState) // Use this method to set the title for the button 

例如:

btn.setTitle(title: "Title", for: .normal) 

注意默认一BTN控制的状态被改变为.Normal.normal

// previous 
public static var Normal: UIControlState { get } 

// Swift 3.0 
static var normal: UIControlState { get } 
相关问题