Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the alpha channel of an existing background color

I have a UITextField which has an rgb already applied to its background color. I'm trying to set the alpha of the background color. How can I set the alpha without reinserting the whole rgb color in Objective-c?

like image 975
Horray Avatar asked Apr 21 '15 21:04

Horray


Video Answer


1 Answers

You can use:

UIColor *color = ...;
color = [color colorWithAlphaComponent:0.5f];
like image 157
Bisca Avatar answered Sep 18 '22 00:09

Bisca