来自UIView的图片 [英] Image from UIView

查看:88
本文介绍了来自UIView的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过UIView创建图像?

is there any Possibility to create a image out of a UIView?

谢谢, 安德烈亚斯(Andreas)

Thanks, Andreas

推荐答案

#import "QuartzCore/QuartzCore.h".然后做:

UIGraphicsBeginImageContext(yourView.frame.size);
[[yourView layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

// The result is *screenshot

这篇关于来自UIView的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆