iOS只给矩形两个边加圆角

- (void)updataTopCornerRadius {
    CGRect clipRect = CGRectMake(0, 0, self.headPhotoIv.width, self.headPhotoIv.width);
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:clipRect byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    maskLayer.frame = clipRect;
    maskLayer.path = maskPath.CGPath;
    self.headPhotoIv.layer.mask = maskLayer;

}

 

posted on 2018-03-28 17:32  土匪7  阅读(148)  评论(0编辑  收藏  举报