iOS UIImage 四周有白色边框 内部没有 如何吧白色边框裁剪掉 留下中间的图案部分
1条回答 默认 最新
- Herry_2016 2016-07-28 08:20关注
使用下面这种方法应该可以解决你的问题
#define magzin 50
CAShapeLayer *layer = [[CAShapeLayer alloc] init];
[layer setFrame:self.imageVIew.bounds];
UIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(magzin, magzin, self.imageVIew.bounds.size.width - 2 * magzin, self.imageVIew.bounds.size.height - 2 * magzin)];
[layer setGeometryFlipped:YES];
[layer setStrokeColor:[[UIColor clearColor] CGColor]];
[layer setFillColor:[[UIColor blackColor] CGColor]];
[layer setLineWidth:0.0];
[layer setLineJoin:kCALineJoinBevel];
[layer setMasksToBounds:YES];
[layer setPath:path.CGPath];
self.imageVIew.layer.mask = layer;解决 无用评论 打赏 举报
悬赏问题
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 对于相关问题的求解与代码
- ¥15 ubuntu子系统密码忘记
- ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
- ¥15 保护模式-系统加载-段寄存器
- ¥15 电脑桌面设定一个区域禁止鼠标操作
- ¥15 求NPF226060磁芯的详细资料
- ¥15 使用R语言marginaleffects包进行边际效应图绘制