Tutorial :How does one populate the results of an UIImagePicker with some “default” images (if the user has none of their own to choose from)



Question:

How does one populate the results of an UIImagePickerController with some "default" images. In this case I have made a photo manipulation app where the user selects an image from their library, but I'd like to give them sample images without actually saving them to their libraries. Is there some way to manually inject my default images in to the the UIImagePicker?


Solution:1

The UIImagePickerController displays what is included in the camera roll.

Are you proposing that there might be a way to also include some images from your bundle when picking from the camera roll? As I do not believe this is the case. You are seeing a copy of the camera roll when using this.

The only way I can see that this will work is that before loading the UIImagePickerController, you write the images from your application bundle to the camera roll.

Upon exiting, delete the images from the camera roll unless it was selected.

This way if they want, the users can select your image and you remove it from the library should they not choose it.

The UIImagePickerController is showing you a representation of the camera roll, so this is the only approach I can imagine would work, and is possibly not ideal.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »