给某视图添加部分圆角
作者:
Heikki_ | 来源:发表于
2016-10-02 21:24 被阅读22次UIView *view = [[UIView alloc]init];
view.frame = CGRectMake(0, 0, 100, 100);
view.center = self.view.center;
view.backgroundColor = [UIColor redColor];
CGRect rect = view.bounds;
CGSize radio = CGSizeMake(30, 30);//圆角大小
UIRectCorner corner = UIRectCornerTopLeft|UIRectCornerBottomLeft;//圆角位置
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corner cornerRadii:radio];
CAShapeLayer *masklayer = [[CAShapeLayer alloc]init];
masklayer.frame = view.bounds;
masklayer.path = path.CGPath;
view.layer.mask = masklayer;
[self.view addSubview:view];
本文标题:给某视图添加部分圆角
本文链接:https://www.haomeiwen.com/subject/yjbdyttx.html
网友评论