How to use UIImagePickerController to select photos directly - ios

I am using UIImagePickerController to select photos. But it will show the list of album first, I have to select a album then go into that album to select photo. How can I specify a default album and let image picker controller to select the photos in that album directly?

I guess all you can do is to choose among these three options UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera, UIImagePickerControllerSourceTypeSavedPhotosAlbum.
If all you wanted to do is to open Camera Roll album directly, specify UIImagePickerControllerSourceTypeSavedPhotosAlbum. I don't think you can get more specific than that.

Related

Show image or video on same tableview cell?

I want to get either image or video from photolibrary and display on same tableview Cell.
I already get image or video from photo library using imagepickercontroller, but don't know how to display on same cell(suppose user select photo then show photo on cell , if user select video , play video).
Note: I select photo from gallery, and don't want to save it.
Note: I don't want to use any 3rd party library.
After selecting the content identify if it is an image or video. Refer this link .
In the Cell add both imageView and videoPlayer. And hide one of them after selecting.

Preserve selection between UICollectionViewControllers

I'm developing an iOS app using Swift 2.0. Actually I'm facing a problem using UICollectionViewControllers to select multiple cells and preserve selection.
What I'm trying to do is to provide the user to select their images from Camera Roll, Facebook or Instagram. So far, I present the photo albums to the user in a PhotoAlbumsTableViewController and show the images in a PhotoCollectionViewController after the user select an album. Everything is working correctly until now.
Now, I want to preserve the selected photos on each album after the user returns to the AlbumsViewController to allow the user to select multiple photos on the Camera Roll then get back and select some others on the Instagram album and then click a Done button to show all the selected images. Any ideas?
Thanks in regards.

Is there any way to navigate to a specific photo album from UIImagePickerViewController?

I know it is possible to show ALL photo albums by setting the source of a uiimagepickerviewcontroller to UIImagePickerControllerSourceTypePhotoLibrary. However, is it possible to then navigate to a specific album if it exists?
No this cannot be.
Unfortunately,The UIImagePickerController is a private, system class, which doesn't really allow alteration.
You can not do this using UIImagePickerController but you can iterate through the gallery album.
Here is an example CustomPhotoAlbumDemo.

Collection view selection like photo library

I have created a UIActionSheet that can display to the user, "Choose Existing Photo" and "Take Photo"
They work just fine. However, instead of choosing an existing photo from the user's library, I want to have them select a premade icon set that I will provide in a UICollectionViewController.
When doing the camera roll, it's as easy as using the line
mediaPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
where mediaPicker is a UIImagePickerController.
I'm sure what I am trying to do is close to the same lines. I have a UICollectionViewController with the icons displayed there, and I want the user to choose one of those so, the exact same functionality of the choosing from photo library.
Any ideas?
Thanks
You need to customize your own UIImagePickerController.
Some people created classes for that.
You can find one example here and another here.

Remove image from custom photo album

Is there a way to remove an image from a custom photo album?
I don't want to permanently delete the asset from the phone but just simply disassociate x image from x album.
I am trying to build an application that automatically manages certain photo albums.
In some cases images would need to be removed from photo albums and added to others.
I am currently using the ALAssetsLibrary to create photo albums and add images to them.
There is no public API to remove an image from a custom/user created album. If you want that feature in the future, request it at https://feedbackassistant.apple.com/.

Resources