Changing color of button text and state

后端 未结 4 1291
隐瞒了意图╮
隐瞒了意图╮ 2020-12-30 00:14

I need to change the color of my button\'s text. I also need to change the state to Disabled after the user presses it.

I have no idea how to do this. I\'ve been loo

4条回答
  •  有刺的猬
    2020-12-30 00:59

    For Swift3, try below code :

     @IBAction func butnClicked(sender : UIButton) {
         sender.setTitleColor(.red, for: .normal)
         sender.isEnabled = false
     }
    

    Set Enabled and text color from story board.

提交回复
热议问题