且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 swift 语言更改按钮背景颜色

更新时间:2023-02-17 21:30:07

button.backgroundColor = UIColor.blue

或任何其他颜色:redgreenyellow

Or any other color: red, green, yellow ,etc.

另一个选项是 RGBA 颜色:

Another option is RGBA color:

button.backgroundColor = UIColor(red: 0.4, green: 1.0, blue: 0.2, alpha: 0.5)