Masking a CALayer with another CALayer

后端 未结 4 849
灰色年华
灰色年华 2021-02-07 08:49

I\'m trying to make a donut shape with CALayers. One CALayer will be a large circle, the other one will be a smaller circle positioned in its center, masking it.

The la

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-07 09:19

    I succeeded with a CAShapeLayer masking a CALayer. To specify the shape of the masking CAShapeLayer I used UIBezierPath.

    I posted the code in my answer to this question: How to Get the reverse path of a UIBezierPath. For the donut shape uncomment the commented line.

提交回复
热议问题