view设置圆角,使用CAShapeLayer绘制圆角,优化app性能

 

UIBezierPath*path=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(0,0,50,50) byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(25, 25)];

//CGRectMake(0, 0, 50, 50)代表视图截取大小  cornerRadii:CGSizeMake(25, 25) 代表视图截取的圆角

 CAShapeLayer *shapLayer = [CAShapeLayer layer];

shapLayer.path = path.CGPath;

headerImageView.layer.mask = shapLayer;

你可能感兴趣的:(IOS,IOS,资料)