我怎样才能制作这样的仪表?

时间:2011-02-28 10:02:44

标签: iphone uiprogressview

我希望制作一个像这样的图像作为图像。

enter image description here

我找不到样品或文章。

感谢

2 个答案:

答案 0 :(得分:1)

您可以对UIProgressView(在iOS上)或NSProgressIndicator(在Mac上)进行子类化。

简单地覆盖 - (void)drawRect:(CGRect)rect并在那里进行自定义绘制。

- (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));
}

我不确定这会做到这一点,没有测试过,但 应该是一个非常基本的progressIndicator

答案 1 :(得分:0)

这个问题和答案应该是有用的:

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

基本上,自己编码。如果你不知道如何,开始学习如何,并在此过程中提出大量(好)问题!