3

Is it possible on iOS to make a regular UIView in some CGRect and add subviews to it and then tell that container UIView something like this:

containerView.layer.path = someClosedUIBezierPath

?

And will then all of the subviews also be curved according to it's parent container view?

I know that every UIView has it's own CALayer and that would be the starting point for me.

I saw examples with animations but I don't see nothing like above (maybe because it isn't there :))

4

1 回答 1

7

这有点晚了,但也许它会帮助某人:

CAShapeLayer您可以使用 a和视图的图层mask属性将视图剪辑到贝塞尔路径:

CAShapeLayer shapeMask = [[CAShapeLayer alloc] initWithFrame:containerView.bounds];
shapeMask.path = someClosedUIBezierPath.CGPath;
containerView.layer.mask = shapeMask;
[shapeMask release];
于 2012-10-22T18:30:22.793 回答