开发者

How can i make a gauge like this?

I hope make a gauge like in this as image.

How can i make a gauge like this?

开发者_运维问答

I don`t find sample souce or article.

thanks


You can do that subclassing UIProgressView ( On iOS ) or NSProgressIndicator ( On Mac ).

Simply override - (void)drawRect:(CGRect)rect and do your custom drawing there.

- (void)drawRect:(CGRect)rect
{
    [self.backgroundColor set];
    UIRectFill(rect); // draw the background


    // determine the size of the "progress"
    float size = (rect.size.width/100)*self.progress;
    [[UIColor blueColor] set]; // blue progress
    UIRectFill(CGRectMake(rect.origin.x,rect.origin.y, size, rect.size.height));
}

I am not sure that this will do it, haven't tested it but it should for a very basic progressIndicator


This question and answer should be useful:

Custom UIActivityIndicator, that is part of customized Framework or as a Sub Class

Basically, code your own. If you don't know how, start learning how, and ask plenty of (good) questions along the way!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜