(IOS)为UIView某个角添加圆角

// 左上角和右下角添加圆角

UIBezierPath*maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(20,20)];

CAShapeLayer *maskLayer = [CAShapeLayer layer];

maskLayer.frame = view.bounds;

maskLayer.path = maskPath.CGPath;

view.layer.mask = maskLayer;

你可能感兴趣的:((IOS)为UIView某个角添加圆角)