Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the color of aUIButton?

Tags:

ios

uibutton

Any idea how to set background color of a UIButton?

I tried to use

self.sendButton.backgroundColor = [UIColor greenColor];

but it didn't work.

like image 674
user836026 Avatar asked Feb 07 '12 14:02

user836026


People also ask

How do I change the color of a button in Swift?

Method 1 − Using the storyboard editorAdd a button on your storyboard, select it Go to it's attribute inspector and select 'Background' property to choose the color.

What is UIButton Swift?

A control that executes your custom code in response to user interactions.


1 Answers

You need to use a custom button. You can set an image as the background or define UIColor.

Take a look at these links:

Iphone UIButton background color

Is it even possible to change a UIButtons background color?

like image 190
BobbyScon Avatar answered Nov 09 '22 23:11

BobbyScon