使用swift语言更改按钮背景颜色 [英] Change button background color using swift language

查看:1121
本文介绍了使用swift语言更改按钮背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是swift语言的新人。有人可以告诉我如何使用swift语言更改按钮的背景颜色?

解决方案

  button.backgroundColor = UIColor.blueColor()

或任何其他颜色: redColor() greenColor() yellowColor()等。 p>

另一个选项是RGBA颜色:

  button.backgroundColor = UIColor :0.4,绿色:1.0,蓝色:0.2,α:0.5)


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

解决方案

button.backgroundColor = UIColor.blueColor()

Or any other color: redColor(), greenColor(), yellowColor() ,etc.

Another option is RGBA color:

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

这篇关于使用swift语言更改按钮背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆