我正在学习Swift,并创建一个应用程序,使用个人照片并在其上放置另一张照片。我现在有一个笨拙的解决方案,即创建该区域的屏幕截图并保存它。我需要用Swift完成这个任务。
@IBAction func saveImage(sender: AnyObject) {
//Create the UIImage
UIGraphicsBeginImageContext(imageView.frame.size)
view.layer.renderInContext(UIGraphicsGetCurrentContext())
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
//Save it to the camera roll
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
}
但是,这个方法以前是有效的,现在却不行了。此外,这也不是最好的解决方案。
所以各位,我该如何将一张个人图片与一个覆盖层一起保存到相机胶卷中呢?
希望能得到帮助!谢谢!