如何设置一个UIButton的颜色?

问题描述:

任何想法如何设置UIButton的背景颜色?如何设置一个UIButton的颜色?

我试图用

self.sendButton.backgroundColor = [UIColor greenColor]; 

,但没有奏效。

+0

可以通过编程方式做到这一点:http://stackoverflow.com/a/5553081/194707 – kevlar 2012-05-16 07:42:14

您需要使用自定义按钮。您可以将图像设置为背景或定义UIColor。

看看这些链接:

Iphone UIButton background color

Is it even possible to change a UIButtons background color?