Boinred
Boinred

Reputation: 29

How can i make a gauge like this?

I hope make a gauge like in this as image.

enter image description here

I don`t find sample souce or article.

thanks

Upvotes: 0

Views: 676

Answers (2)

Antwan van Houdt
Antwan van Houdt

Reputation: 6991

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

Upvotes: 1

occulus
occulus

Reputation: 17014

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!

Upvotes: 0

Related Questions