Change button background color using swift language

前端 未结 11 2197
暗喜
暗喜 2020-12-08 13:09

I am new to the swift language. Can someone tell me how to change the background color of a button using the swift language?

11条回答
  •  一整个雨季
    2020-12-08 13:49

    After you connect the UIButton that you want to change its background as an OUtlet to your ViewController.swift file you can use the following:

     yourUIButton.backgroundColor = UIColor.blue
    

提交回复
热议问题