来自 UIView 的图像 [英] Image from UIView
本文介绍了来自 UIView 的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能从 UIView 中创建图像?
is there any Possibility to create a image out of a UIView?
谢谢,安德烈亚斯
推荐答案
#import "QuartzCore/QuartzCore.h"
将框架添加到项目后.然后做:
#import "QuartzCore/QuartzCore.h"
after you added the framework to your project. Then do:
UIGraphicsBeginImageContext(yourView.frame.size);
[[yourView layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// The result is *screenshot
这篇关于来自 UIView 的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文