我从一个按钮呈现一个弹出窗口,在popover用户可以制作一个绘图。我想将这张图作为UIImage捕获。
目前,绘图是使用UIBezierPath的简单线条图,类似于本教程:http://soulwithmobiletechnology.blogspot.com/2011/05/uibezierpath-tutorial-for-iphone-sdk-40.html
提前感谢您的帮助!
答案 0 :(得分:0)
如果有其他人遇到此事。如果你找不到renderInContext
#import <QuartzCore/QuartzCore.h>
答案 1 :(得分:0)
用于实际的复制粘贴解决方案:
#import <QuartzCore/QuartzCore.h>
- (UIImage*) screenShot {
UIGraphicsBeginImageContext(_view.bounds.size);
[_view.layer renderInContext: UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); //renders view to an image
UIGraphicsEndImageContext();
return viewImage;
}