我想将UIImageView转换为UIImage或PDF格式,是否可能?

时间:2012-09-09 02:41:37

标签: ios5

我已经采取了一个UIImageView它采取了一些标签现在我想将这个UIImageView转换为UIImage或PDF也可以吗?

1 个答案:

答案 0 :(得分:0)

根据您的问题,您似乎想截取视图的屏幕截图并将其另存为图片或pdf。 您可以使用以下代码截取视图截图并将其保存在照片库中。

UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShotimage = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenShotimage, nil, nil, nil);
UIGraphicsEndImageContext();