我希望制作一个像这样的仪表作为图像。
我没有找到示例源或文章。
谢谢
您可以继承 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));
}
我不确定这会不会,还没有测试过,但它应该是一个非常基本的进度指示器
这个问题和答案应该很有用:
自定义 UIActivityIndicator,它是自定义框架的一部分或作为子类
基本上,编写自己的代码。如果您不知道如何,请开始学习如何,并在此过程中提出大量(好的)问题!