6
@IBOutlet weak var catParentIdButton: UIButton!
我有这段代码,现在我想以编程方式编写按钮标签。
在swift 3.0中编写按钮标签的语法是什么?如何在swift 3中设置按钮标签?
@IBOutlet weak var catParentIdButton: UIButton!
我有这段代码,现在我想以编程方式编写按钮标签。
在swift 3.0中编写按钮标签的语法是什么?如何在swift 3中设置按钮标签?
方法签名在夫特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 }
'downloadButton.setTitle(“Your Title”,for:.normal)' – iDeveloper