Search code examples
iosobjective-cuilabeluicolor

Setting RGB programmatically


How can we set the color of a label text programmatically, my color is R 77 G 104 B 159 I have tried the below code but no use.

Label.textColor = [UIColor colorWithRed:77.0 green:104.0 blue:159.0 alpha:1.0];

Solution

  • Please try the code

    Label.textColor=[UIColor colorWithRed:77.0/255.0f green:104.0/255.0f blue:159.0/255.0f alpha:1.0];