Tuesday, September 24, 2013

UILabel how custom font color?

Using this brings up the system colors, [label setTextColor: [UIColor redColor]];
But you can not use the following recall how the color you want it? I used color measurement instruments test out the standard RGB color, but how can not appear the color you want, but in the xib file where you can bring your own colors, and who has not encountered a similar problem to help solve it.
[Label setTextColor: [UIColor colorWithRed: 95 green: 190 blue: 125 alpha: 1]];
This is a xib inside tune effect
Reply:
Try this instead:
[Label setTextColor: [UIColor colorWithRed: 95.f/255.f green: 190.f/255.f blue: 125.f/255.f alpha: 1]];
Reply:
Each value is divided by 255 is like, he is a percentage of the value, not the value directly with gdb
Reply:
Oh, I see, I tried it, thank them!

No comments:

Post a Comment