0

I hope make a gauge like in this as image.

enter image description here

I don`t find sample souce or article.

thanks

koregan
  • 10,054
  • 4
  • 23
  • 36
Boinred
  • 29
  • 1
  • 4

2 Answers2

1

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

Antwan van Houdt
  • 6,989
  • 1
  • 29
  • 52
  • 1
    UIActivityIndicator isn't really designed to be subclassed out of the box. It might work, of course; have you successfully done this yourself? – occulus Feb 28 '11 at 10:12
  • Then subclass UIView, haven't tried it myself, add a property of progress and you're done. – Antwan van Houdt Feb 28 '11 at 10:13
0

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!

Community
  • 1
  • 1
occulus
  • 16,959
  • 6
  • 53
  • 76