ios – 更改UIImageview形状矩形的默认形状

现在我开发一个项目,我需要显示带有边框的图像,如下面的形状.

我怎样才能做到这一点?我不知道这样做.请任何想法解决.

解决方法

可能这段代码会帮你…
UIBezierPath *maskPath;
 maskPath = [UIBezierPath bezierPathWithRoundedRect:YourImageVIew.bounds byRoundingCorners:(UIRectCornerTopRight | UIRectCornerBottomRight) cornerRadii:CGSizeMake(50.0,50.0)];

 CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
 maskLayer.frame = YourImageVIew.bounds;
 maskLayer.path = maskPath.CGPath;
 YourImageVIew.layer.mask = maskLayer;

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...