Search code examples
objective-cuicolorargb

Create UIColor object from ARGB value


I've in a database a few rows where one field is ARGB value for the related color.

I've to read all the rows of these table and convert the ARGB value decimal to a UIColor.

I've googled finding this, but I didn't.

Is there any way to approach this?

Thanks.


Solution

  • text.color = [UIColor colorWithRed:10.0/255.0 green:100.0/255.0 blue:55.0/255.0 alpha:1];
    

    You just need to divide the RGB values by 255 to get things to set up correctly.