//切圆角,封装了一个方法,网络上搜集到,方便自己使用
- (void)setMaskTo:(UIView*)view byRoundingCorners:(UIRectCorner)corners
{
UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(8.0, 8.0)];
CAShapeLayer *shape = [[CAShapeLayer alloc] init];
[shape setPath:rounded.CGPath];
view.layer.mask = shape;
}
//调用
[self setMaskTo:_infoView byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight];
可以切任意圆角,效果如图