iOS控件设置部分圆角

2020-01-08  本文已影响0人  小言_0480

部分角圆角

UIView *view2 =[[UIView alloc]initWithFrame:CGRectMake(120,10,80,80)];

view2.backgroundColor =[UIColor redColor];

[self.view addSubview:view2];

UIBezierPath *maskPath =[UIBezierPath bezierPathWithRoundedRect:view2.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10,10)];

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

maskLayer.frame = view2.bounds;

maskLayer.path = maskPath.CGPath;

view2.layer.mask = maskLayer;

view2.backgroundColor =[UIColor colorWithWhite:0.509 alpha:0.6]uiview设置透明色

上一篇 下一篇

猜你喜欢

热点阅读