change text of button and disable button in iOS

后端 未结 8 872
Happy的楠姐
Happy的楠姐 2020-12-23 12:52

How do you change the text of the button and disable a button in iOS?

8条回答
  •  旧时难觅i
    2020-12-23 13:26

    In Swift 3, you can simply change the title of a button by:

    button.setTitle("Title", for: .normal)
    

    and you disable the button by:

    button.isEnabled = false
    

    .normal is the same as UIControlState.normal because the type is inferred.

提交回复
热议问题