Changing UIButton text

后端 未结 7 1444
遇见更好的自我
遇见更好的自我 2020-12-25 10:23

So I\'m trying to update the text on a UIButton when I click it. I\'m using the following line to change the text:

calibrationButton.titleLabel.text = @\"Cal         


        
7条回答
  •  渐次进展
    2020-12-25 11:02

    If you don't want to set the title for all states, just set it for the normal state since the title for the unset states will default to the title of the normal state.

    btn.setTitle("Some text", for:.normal)
    

提交回复
热议问题