Change button background color using swift language

前端 未结 11 2270
暗喜
暗喜 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

    Swift 3

    Color With RGB

    btnLogin.backgroundColor = UIColor.init(colorLiteralRed: (100/255), green: (150/255), blue: (200/255), alpha: 1)
    

    Using Native color

    btnLogin.backgroundColor = UIColor.darkGray
    

提交回复
热议问题