【问题标题】:Saving a view and its contents as image or pdf将视图及其内容保存为图像或 pdf
【发布时间】:2012-07-10 16:10:10
【问题描述】:

我有一个视图,其中插入了许多文本字段和值。现在我想将此视图另存为图像或 pdf。

有什么方法可以实现吗?我正在为项目使用 IOS 5.1

【问题讨论】:

标签: ios ios5 uiimage pdf-generation


【解决方案1】:

您可以截取视图并保存:

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

现在你有了整个视图内容的 UIImage,你可以按照你喜欢的方式使用它..

【讨论】:

    猜你喜欢
    • 2018-03-01
    • 2012-03-30
    • 1970-01-01
    • 2011-11-12
    • 1970-01-01
    • 2016-08-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多