bra*_*ray 4 iphone ios progress-bar
我喜欢Xcode中的小饼形进度条,当在项目中搜索字符串时(Shift-Command-F),请参见图片.
怎么能在iOS上调用它?我很乐意将它用于下载队列.
提前致谢.

没有股票循环确定性进展视图.这是drawRect:您可能用于实现此类事物的示例.
- (void)drawRect:(CGRect)rect
{
CGFloat circleRadius = (self.bounds.size.width / 2) - (self.strokeWidth * 2);
CGPoint circleCenter = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));
CGRect circleRect = CGRectMake(circleCenter.x - circleRadius, circleCenter.y - circleRadius, 2 * circleRadius, 2 * circleRadius);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
// Draw stroked circle to delineate circle shape.
CGContextSetStrokeColorWithColor(context, self.fillColor.CGColor);
CGContextSetLineWidth(context, self.strokeWidth);
CGContextAddEllipseInRect(context, circleRect);
CGContextStrokePath(context);
// Draw filled wedge (clockwise from 12 o'clock) to indicate progress
self.progress = MIN(MAX(0.0, self.progress), 1.0);
CGFloat startAngle = -M_PI_2;
CGFloat endAngle = startAngle + (progress * 2 * M_PI);
CGContextSetFillColorWithColor(context, self.fillColor.CGColor);
CGContextMoveToPoint(context, circleCenter.x, circleCenter.x);
CGContextAddLineToPoint(context, CGRectGetMidX(circleRect), CGRectGetMinY(circleRect));
CGContextAddArc(context, circleCenter.x, circleCenter.y, circleRadius, startAngle, endAngle, NO);
CGContextClosePath(context);
CGContextFillPath(context);
CGContextRestoreGState(context);
}
Run Code Online (Sandbox Code Playgroud)
您需要创建strokeWidth和fillColor属性才能直接使用此代码,但它应该是一个开始.这是一个带有几个例子的示例项目.
| 归档时间: |
|
| 查看次数: |
5306 次 |
| 最近记录: |