//初始化UIView
UIView * view = [UIView alloc]initWithFrame:CGRectMake(0,0,[UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height)];
[view setBackgroundColor:[UIColor White]];
[self.view addSubview:view];
//设置view左侧上UIRectCornerTopLeft 和 左侧下UIRectCornerBottomLeft为5的圆角
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer * layer = [[CAShapeLayer alloc]init];
layer.frame = view.bounds;
layer.path = path.CGPath;
view.layer.mask = layer;
//设置view 全部角为圆角
viewT.layer.cornerRadius = 10;//设置那个圆角大小
viewT.layer.masksToBounds = YES;//设置YES是保证添加的图片覆盖视图的效果
网友评论