How to clip a CAShapeLayer?
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];
精彩评论