I am trying to get a color to show up on screen just like the charging battery (shown here):
After looking at the Apple Documentation on UIColor
here, I have attempted using both colorWithHue:saturation:brightness:aplha:
and colorWithRed:green:blue:alpha:
to get a color to show up like that.
For example when I use colorWithHue:.3 saturation:.84 brightness:1 alpha:.5
on a black background, it renders a color like this:
or the colorWithRed:0 green:1 blue:0 alpha:.5
on a black background shows up like this:
It doesn't have that translucent or glossy look to it.
Is there a better method to use? Or do I just not have the values right? (I have tried many combinations)
UIColor
represents only one colour with an opacity value (if you've stated one). In your case you might want to either use images, or override the drawRect
method in a custom UIView
class (Core Graphics). Take a look here for a brief introduction to the latter.