CAShapeLayer *circle = [CAShapeLayer layer];
circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(x, y, 100, 100) cornerRadius:50].CGPath;
// Configure the apperence of the circle
circle.fillColor = [UIColor whiteColor].CGColor;
circle.strokeColor = [UIColor darkGrayColor].CGColor;
circle.lineWidth = 1.8;
circle.lineDashPattern = @[@6, @3];
// Add to parent layer
[cell.layer addSublayer:circle];
我正在使用此代码绘制一个圆圈。现在,我想使用渐变作为笔触颜色。我怎么能这样做?