Pick an Image / image picker

This example is to show how to pick an image from a soure ( in this case, the Saved Photos )

 

First create the function for the Image Picker:

Then this is what we are actually gonna tie up to our button for loading an image:

3 thoughts on “Pick an Image / image picker

  1. Hi!

    How would I do this so it loads from a UICollectionView cell when selected?

    I’m trying to make an App where the user can load an image from the photoAlbum, and then load a image from the app as an overlay.

    I have the UIImagePickerController all set and working with subViews and gestureRecognizers, I have UICollectionView setup and populated with my overlay images. But how do i do it so that when i select a cell it loads the image into the same imageView as the subViews?

    Any advice would be much appreciated!

  2. Razvigor Andreev says:

    I already answered on your similar question, but to be honest you can always use a barbaric way of doing it, if you only have a small number of UIViews. Let’s say you have 4 by 3 UIVIews = 12 total. Create a variable that would be like : var cellNumber: Int = 1 . Then you can change it depending on which UIView you touch and have the image placed in the correct subView taken from that ‘var’… That is probably the worst way of doing it 🙂 I might look into that UICollectionView soon, it does seem like something useful. I found another article on someone having a similar problem btw: http://stackoverflow.com/questions/17516715/uicollectionview-doesnt-show-cell-images