利用CAShapeLayer創建圓形圖片
作者:
夏至末Kara | 来源:发表于
2017-06-29 20:55 被阅读0次UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
imageView.image = [UIImage imageNamed:@'1'];
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:imageView.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:imageView.bounds.size];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init]; //设置大小
maskLayer.frame = imageView.bounds; //设置图形样子
maskLayer.path = maskPath.CGPath;
imageView.layer.mask = maskLayer;
本文标题:利用CAShapeLayer創建圓形圖片
本文链接:https://www.haomeiwen.com/subject/tmuvcxtx.html
网友评论