- (UIImage*)convertViewToImage:(UIView*)v
{
UIGraphicsBeginImageContext(v.bounds.size);
[v.layerrenderInContext:UIGraphicsGetCurrentContext()];
UIImage*image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
returnimage;
}
UIView转UIImage
最新推荐文章于 2020-04-30 14:49:24 发布
本文介绍了一种将UIView转换为UIImage的方法。通过使用UIGraphicsBeginImageContext开始图像上下文,并利用视图的layer进行渲染,最终获取到当前图像上下文中的图像并返回。
473

被折叠的 条评论
为什么被折叠?



