I am having the color codes as R:38 G:171 B:228 , but when I set the values as .38f in the color with Red : Green : Blue:, I am unable to get the desired color:
[CategoryLbl setTextColor:[UIColor colorWithRed:.38f green:.171f blue:.226f alpha:1.0f]];
Please help.
You’re mixing up two scales: UIColour looks like it uses floating point values 0-1 whereas the usual RGB values are 0-255. Instead you want
so
There may be better ways to do this, e.g. using the 0-255 values – I don’t know OSX / iPhone development well.
Actually it looks like you can just do:
which is easier to understand (although I gave you enough d.p. the first one should be as accurate).