Save image in UIImageView to iPad Photos Library

前端 未结 4 1187
死守一世寂寞
死守一世寂寞 2020-12-31 22:40

I am creating an iPad app that has several pictures (UIImageViews) in a horizontal scrollview. I want to allow the user to be able to save the images to their P

4条回答
  •  既然无缘
    2020-12-31 23:30

    In Swift:

        // Save it to the camera roll / saved photo album
        // UIImageWriteToSavedPhotosAlbum(self.myUIImageView.image, nil, nil, nil) or 
        UIImageWriteToSavedPhotosAlbum(self.myUIImageView.image, self, "image:didFinishSavingWithError:contextInfo:", nil)
    
        func image(image: UIImage!, didFinishSavingWithError error: NSError!, contextInfo: AnyObject!) {
                if (error != nil) {
                    // Something wrong happened.
                } else {
                    // Everything is alright.
                }
        }
    

提交回复
热议问题