I want to add a gradient color to my UILabel or any text on my iPhone screen. I want to know the ways to do it. Both Using interface and programatically.
tnx
I want to add a gradient color to my UILabel or any text on my iPhone screen. I want to know the ways to do it. Both Using interface and programatically.
tnx
EDIT:
I expanded on my previous comment after all and created a little subclass of UILabel for this purpose. You can read about it here where you can also get the code.
This is the result:
Old reply:
Please see my reply to this question: How do I add a gradient to the text of a UILabel, but not the background?
Shows the code needed to achieve what you are after.
In in the interface, you should be able to select the label and go to inspector (apple + 1) and change the color from there.
Programmatically, use the following property.
UILabel textColor property reference
Example:
[mylabel setTextColor: [UIColor redColor]];
To gradient, all you have to do is extend this a little. Break the text that you want to gradient into a group of labels, group them with a list of some sort, and iterate over the grouped labels and apply a textColor. This sort of gradient is trivial and derives immediately from the documentation provided.