非常标准的设置:VC 视图的顶角通过 CAShapeLayer 和 UIBezierPath 进行了圆角处理,如下所示:
UIBezierPath *cornerPath = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds
byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
cornerRadii:CGSizeMake(4, 4)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = self.view.bounds;
maskLayer.path = cornerPath.CGPath;
self.view.layer.mask = maskLayer;
虽然这可行,但它会导致整个视图被渲染到屏幕外,当然应该有一种方法至少可以将渲染最小化到角落,甚至摆脱它?