简体   繁体   中英

Clipping out a CALayer's background color or border?

In CALayer, you can assign a background color for the fill or the border width and color for the border.

Is there a way to apply a clipping path or mask to have the CALayer not draw a portion of the border or the background?

You can set the mask property of your layer to a CAShapeLayer , and set the path property of the shape layer to your clipping path. Or you can set the mask property of your layer to a regular CALayer and set the mask layer's contents property to a CGImage containing your mask.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM