开发者

How to clip a CAShapeLayer?

开发者 https://www.devze.com 2022-12-16 09:42 出处:网络
I have a CAShapeLayer that i add a CAGradientLayer to, but there is no clipping about the shape of the CAShapeL开发者_如何学JAVAayer.From your question it sounds more like you want to use a shape laye

I have a CAShapeLayer that i add a CAGradientLayer to, but there is no clipping about the shape of the CAShapeL开发者_如何学JAVAayer.


From your question it sounds more like you want to use a shape layer as a mask for a gradient layer. Create your CAShapeLayer adding a path to it. Then create a CAGradientLayer and set it's mask property. Then add your gradient layer to the layer hierarchy in your view.

[gradientLayer setMask:shapeLayer];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号