UIView with rounded corners: how to clip subviews correctly? UIView with rounded corners: how to clip subviews correctly? ios ios

UIView with rounded corners: how to clip subviews correctly?


I haven't tried it, but I think you could use CALayer's mask property to do this. You'd have to draw your rounded rectangle into a layer that was set as the mask to your view layer.


It is possible (and, in fact, very easy) to specify particular rounded corners without resorting to drawRect:, or manually drawing a partially rounded rect into a layer. See my answer on a similar question.