CAShapeLayer中的渐变为圆形笔触颜色

时间:2014-05-12 08:40:07

标签: objective-c ios7 core-graphics cashapelayer

    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];

我正在使用此代码绘制一个圆圈。现在,我想使用渐变作为笔触颜色。我怎么能这样做?

0 个答案:

没有答案