Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable clipping in CALayer

How do I disable clipping in a CALayer? I am overriding drawInContext, but I want to be able to draw lines that extend outside the bounds of the CALayer and I do not want to do a separate drawing pass on the parent layer to make this happen.

like image 466
jjxtra Avatar asked Dec 27 '10 21:12

jjxtra


1 Answers

You can't draw using Quartz outside of the bounds of a CALayer or UIView. As Noah suggests, you'll need to expand the bounds of the layer by a set amount in order to draw this.

You can still do this without having to do some drawing in the parent layer, as long as your parent layer's masksToBounds property is set to NO. That way, even if your sublayer extends out past the edge of the parent, it will still be drawn properly.

like image 178
Brad Larson Avatar answered Oct 06 '22 18:10

Brad Larson