[英]How to get a green to show up like the charging battery on the iPhone lock screen?
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.看着对苹果文档后UIColor
这里,我一直在使用这两种尝试colorWithHue:saturation:brightness:aplha:
和colorWithRed:green:blue:alpha:
为了获得彩色显示得那样。
For example when I use colorWithHue:.3 saturation:.84 brightness:1 alpha:.5
on a black background, it renders a color like this:例如,当我在黑色背景上使用colorWithHue:.3 saturation:.84 brightness:1 alpha:.5
时,它会呈现如下颜色:
or the colorWithRed:0 green:1 blue:0 alpha:.5
on a black background shows up like this:或者黑色背景上的colorWithRed:0 green:1 blue:0 alpha:.5
显示如下:
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). UIColor
仅表示一种具有不透明度值的颜色(如果您已经说明了一种颜色)。 In your case you might want to either use images, or override the drawRect
method in a custom UIView
class (Core Graphics).在您的情况下,您可能想要使用图像,或覆盖自定义UIView
类(核心图形)中的drawRect
方法。 Take a look here for a brief introduction to the latter.看这里对后者的简要介绍。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.