iOS 让UIView的左上角和右上角为圆角

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/walkerwqp/article/details/81865479


-(UIView *)platFormBGV{

if (!_platFormBGV) {

_platFormBGV = [[UIView alloc] init];

_platFormBGV.backgroundColor = [UIColor whiteColor];

_platFormBGV.frame = CGRectMake(0, self.view.frame.size.height, APP_WIDTH, 220);

// 左上和右上为圆角

UIBezierPath *cornerRadiusPath = [UIBezierPath bezierPathWithRoundedRect:_platFormBGV.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(16, 16)];

CAShapeLayer *cornerRadiusLayer = [ [CAShapeLayer alloc ] init];

cornerRadiusLayer.frame = _platFormBGV.bounds;

cornerRadiusLayer.path = cornerRadiusPath.CGPath; _platFormBGV.layer.mask = cornerRadiusLayer; } return _platFormBGV;

}

猜你喜欢

转载自blog.csdn.net/walkerwqp/article/details/81865479