How can i make a gauge like this?
I hope make a gauge like in this as image.
开发者_运维问答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!
精彩评论