如何在IOS目标C

问题描述:

我想添加的UIView添加的UIView中的UIImageView(的UIView有包含一些图片和文字)在的UIImageView和ImageView的,我想在我的相机胶卷保存。所以请给我一些建议或快照帮助我解决这个问题。 Click Here For UIScreen如何在IOS目标C

在我的情况,我有一个UIView和一个UIImageView贴在了UIView增加,我想将它们合并和亚我想以横向模式

任何帮助或建议,可以欣赏图像。

谢谢。

+0

检查此问题http://*.com/questions/30696307/how-to-convert-a-uiview-to-a-image – iOS

我也有类似的任务,并使用此代码:

func getResultImage() throws -> (image: UIImage, path: URL) { 
    UIGraphicsBeginImageContextWithOptions(bounds.size, false, UIScreen.main.scale) 
    defer { 
     UIGraphicsEndImageContext() 
    } 
    drawHierarchy(in: self.bounds, afterScreenUpdates: true) 

    guard let image = UIGraphicsGetImageFromCurrentImageContext() else { 
     throw ImageEditorViewError.noImageGenerated 
    } 

    guard let data = UIImagePNGRepresentation(image) else { 
     throw ImageEditorViewError.noDataRepresentation 
    } 

    let writePath = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("Image.png") 

    try data.write(to: writePath) 

    return (image, writePath) 
} 

您可以writePaht去除部分,因为它是具体的我的任务

假设,这个代码是你的容器视图中和你有一些意见 - 贴在里面

+0

谢谢你的答案,但即时工作对目标c不敏捷。它不能解决我的问题 –