我已经实现了把一个UIView直接生成图片。UIGraphicsBeginImageContext(myView.bounds.size);[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();
1 回答

达令说
TA贡献1821条经验 获得超6个赞
[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
这个地方不是已经获取到当前图像的context了么,然后用路径裁剪获取需要的部分应该就可以吧。
CGContextBeginPath(context); CGContextAddRect(context, rect) CGContextClip(context);
不知道可以么,没有试。
- 1 回答
- 0 关注
- 130 浏览
添加回答
举报
0/150
提交
取消