Reputation: 783
I am changing a UILabels
text color too the given code below, but it is not working.
Q1.textColor=[UIColor colorWithRed:88/255.0 green:89/255.0 blue:91/255.0 alpha:0];
Upvotes: 0
Views: 1290
Reputation: 113
Besides providing alpha value 0.0, Check for integer division vs float division as the method needs floats, so when you are dividing 88 (int) by a 255.0 (float) you are providing 0 instead of 0.34 for red value and similarly for green and blue.
Upvotes: 1
Reputation: 366
You need to change alpha to 1, Alpha represents opacity ( transparency).
Upvotes: 0
Reputation: 27050
[Q1 setTextColor:[UIColor colorWithRed:88.0/255.0 green:89.0/255.0 blue:91.0/255.0 alpha:1.0]];
You just forget to add alpha:1.0
:)
Upvotes: 0
Reputation:
You probably wanted the alpha to be equal to 1 instead of 0 (zero means fully transparent, you might have misunderstood this...):
Q1.textColor = [UIColor colorWithRed:88 / 255.0f
green:89 / 255.0f
blue:91 / 255.0f
alpha:1.0f];
By the way, the title of your question is inaccurate. The text color is most probably changing, but you don't see the text since it's transparent.
Upvotes: 1
Reputation: 6746
Are you trying to make it transparent? You should try alpha 1.
Q1.textColor = [UIColor colorWithRed:88/255.0 green:89/255.0 blue:91/255.0 alpha:1];
Upvotes: 0
Reputation: 3666
Q1.textColor=[UIColor colorWithRed:(88/255.f) green:(89/255.f) blue:(91/255.f) alpha:1];
Upvotes: 1
Reputation: 38239
Do this as your color alpha is 0 means transparent
Q1.textColor=[UIColor colorWithRed:88.0/255.0 green:89.0/255.0 blue:91.0/255.0 alpha:1];
Upvotes: 0