【发布时间】:2012-07-10 16:10:10
【问题描述】:
我有一个视图,其中插入了许多文本字段和值。现在我想将此视图另存为图像或 pdf。
有什么方法可以实现吗?我正在为项目使用 IOS 5.1
【问题讨论】:
-
这里有很多重复的问题...一个:stackoverflow.com/questions/3495370/image-from-uiview
标签: ios ios5 uiimage pdf-generation
我有一个视图,其中插入了许多文本字段和值。现在我想将此视图另存为图像或 pdf。
有什么方法可以实现吗?我正在为项目使用 IOS 5.1
【问题讨论】:
标签: ios ios5 uiimage pdf-generation
您可以截取视图并保存:
UIGraphicsBeginImageContext(self.view.frame.size);
[[self.view layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
现在你有了整个视图内容的 UIImage,你可以按照你喜欢的方式使用它..
【讨论】: