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 Photo Library when they tap on one of the UIImageView
s. I like the way Safari handles this matter: you just tap and hold until a pop up menu appears and then click save image. I know there is the "UIImageWriteToSavedPhotosAlbum
". But I am a newbie to iOS development and I'm not too sure where to go with it and where to put it (i.e. how to detect which image was tapped).
From what I have found, I have seen people use UIImage
instead of UIImageView
. Do I need to convert my view to UIImage
? If so, how? How do I detect when the user taps the images, and which UIImageView
was tapped? If you could point me in the right direction, and maybe some examples I would greatly appreciate it.
In regards to the part of your question asking how to detect which UIImageView was tapped, you can use code like the following:
You can use the
image
property of aUIImageView
to get the current image:In Swift: