Changing UIButton text

后端 未结 7 1433
遇见更好的自我
遇见更好的自我 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:10

    To set button text use the following method:

    [calibrationButton setTitle: @"Calibration" forState: UIControlStateNormal];
    

    See UIButton class reference for more details... http://developer.apple.com/library/ios/#documentation/uikit/reference/UIButton_Class/UIButton/UIButton.html

    Or in Swift 3:

    calibrationButton.setTitle("Calibration", for: .normal)
    

提交回复
热议问题