0

My app takes some videos and pictures and stores them in the Application Home/Documents folder. I want to create a gallery that will open and display (and playback) these items. I looked into MPMediaPickerController and it looks like the only option for data source there is the Photos Album.

It looks like I will have to go with creating UICollectionView. Is this the right way to do this or is there another way similar to MPMediaPickerController but with setting the source to an array of data objects?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
noobuntu
  • 903
  • 1
  • 18
  • 42
  • 1
    You have to implement your own viewer. – rmaddy Nov 14 '15 at 04:35
  • Gah! That is kind of terrible. I am leaning towards auto-save in Gallery in that case... Any idea if there are any cocoapods that implement this behaviour? – noobuntu Nov 14 '15 at 04:37
  • Of course your other option is to use one of the many 3rd party photo viewers available on places like Github. – rmaddy Nov 14 '15 at 04:45

1 Answers1

1

The best way to do it is use your own implementation UICollectionView. MPMediaPickerController mainly works for media related(especially for songs and videos)

Since you have images and videos just use NSFilemanager to get the files in Documents Directory and pass the information to UICollectionView datasource and handle the touch actions on the UICollectionView didSelect methods.

ipraba
  • 16,485
  • 4
  • 59
  • 58
  • OK Thank you for your reply. I figured this is the way to go but wanted to check before I went this route. So far it doesn't look too gnarly but I might just auto-save to Gallery for now and implement it later on.. – noobuntu Nov 14 '15 at 04:39
  • Do you see any downsides of auto-save to Gallery? (ie the Photos app) – noobuntu Nov 14 '15 at 04:39
  • 1
    That depends on your app need for the users. If you want those photos and images to be available for other apps also you can just save them there. Or if you want the photos to be specific for your app then you can go for saving inside your app documents directory. just think it from your users points of view. – ipraba Nov 14 '15 at 04:45