我有一个自定义的CAShapeLayer类,在那里我使用“bezierPathWithArcCenter”绘制一个带有一些笔触颜色的圆形图像 . 这工作正常,我得到一个圆形图像 . 现在为此添加渐变 . 我添加了以下行

_gradient = [CAGradientLayer layer];
_gradient.colors = @[(id)[UIColor greenColor].CGColor,
                    (id)[UIColor colorWithWhite:0.90 alpha:1.0].CGColor];
_gradient.frame = CGPathGetBoundingBox(_progressLayer.path);

其中_gradient.frame = CGPathGetBoundingBox(self.path)始终返回0 .

我在哪里弄错了?

我希望看到如下

enter image description here

提前致谢 .