前言:ios開發(fā)中經(jīng)常遇到一個(gè)view上只要兩個(gè)圓角的情況。
1.切四個(gè)圓角的情況
view.layer.cornerRadius = 12;
view.layer.masksToBounds = YES;
2.單獨(dú)切圓角的情況蛉拙,比如切左上尸闸、右上兩個(gè)圓角
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_WIDTH, 1000) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bottomView.bounds;
maskLayer.path = maskPath.CGPath;
self.bottomView.layer.mask = maskLayer;
解決!
查看更多孕锄!