Objective-C:循环进度视图

时间:2016-07-22 07:15:03

标签: ios objective-c progress

如何使用默认progresView在app store中创建progressView?

如下图所示:

enter image description here

1 个答案:

答案 0 :(得分:2)

您可以使用此代码,我已经为您绘制了圆圈。

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

CAShapeLayer* outsideShapeLayer = [[CAShapeLayer alloc] init];
outsideShapeLayer.fillColor = [[UIColor clearColor] CGColor];
outsideShapeLayer.frame = CGRectMake(100, 100, 100, 100);
outsideShapeLayer.path = [[UIBezierPath bezierPathWithOvalInRect:outsideShapeLayer.bounds] CGPath];
outsideShapeLayer.lineWidth = 1;
outsideShapeLayer.strokeColor = [[UIColor blueColor] CGColor];
[self.view.layer addSublayer:outsideShapeLayer];


CAShapeLayer* shapeLayer = [[CAShapeLayer alloc] init];
shapeLayer.fillColor = [[UIColor clearColor] CGColor];
shapeLayer.frame = CGRectMake(102.5, 102.5, 95, 95);
shapeLayer.path = [[UIBezierPath bezierPathWithOvalInRect:shapeLayer.bounds] CGPath];
shapeLayer.lineWidth = 5;
shapeLayer.strokeColor = [[UIColor blueColor] CGColor];
shapeLayer.strokeStart = 0;
shapeLayer.strokeEnd = 0.75f;
[self.view.layer addSublayer:shapeLayer];
}

希望它可以帮到你。