答案 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];
}
希望它可以帮到你。