Adding a "Pick from Photo Library" button to UIImagePickerController's toolbar - ios

I am implementing a flow where the user can either select a photo from their library or take a photo using the camera.
When presenting the UIImagePickerController modally I have to either go:
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
or
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
This means presenting a "scaffolding controller" where to user can pick either their Library or the Camera.
I see that most other apps with this kind of functionality go directly to the Camera controller, but displays a button for selecting from the library instead.
All examples/tutorials I can find, including Apple's PhotoPicker source, does this empty viewController where you pick from camera or library - but all apps I check does the 'direct to camera - with the option for going to library".
How do I add the photo library button option to the camera tool bar?
(app >= iOS 4.3)
Thanks for any help given.

According to this previous question
Enabling the photo library button on the UIImagePickerController
you can use cameraOverlayView and showsCameraControls to make the implementation.
-Vik

For this purpose I have used PhotoPicker by Apple.

Related

Can ImagePickerController have the previewView when picked photo done?

I have a view controller with UIImagePickerControllerDelegate and UINavigationControllerDelegate to pick photo.
I also want to make the same preview view when I picked photo done like the preview view when I taken photo done.
Have any suggestion? Thx!
You can get the UIImagePickerController to show the preview screen when choosing a photo if you set picker.allowsEditing to true. Be aware though that this will allow users to crop and reposition their photo in both the photo library and camera source types.

How to show all camera controls with/for UIImagePickerController?

I have trouble showing the camera controls when using UIImagePickerController. Specifically, I need to be able to select between slo-mo, video, photo, square and pano.
The essential part of code I use is:
UIImagePickerController *pc = [[UIImagePickerController alloc] init];
[pc setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
pc.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage, nil];
But this shows a picker controller with the ability to take a picture only i.e., no square nor pano modes either.
Setting pc.mediaTypes to:
pc.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage, (NSString *)kUTTypeMovie, nil];
..shows a picker controller with video and photo. But how do I get the other camera modes/types to show? E.g. what is the UTType for pano?
UIImagePickerController doesn't give you Apple's whole Camera app to use inside of your own app. Not all of the functionality of the Camera app is available. You can print available media types by calling -[UIImagePicker availableMediaTypesForSourceType:] and you'll find that you get kUTTypeImage and kUTTypeMovie.
Square, slo-mo, time-lapse, and panorama functionalities are not provided by UIImagePickerController.
UIImagePickerController came out in iOS 2.0, and was probably modern, in its time:
https://developer.apple.com/documentation/uikit/uiimagepickercontroller?language=objc
What you see are "standard controls".
Even today the modern documentation points to the legacy (Objective-C era docs)
The styling of the chrome has changed, but as they say: "the song remains the same."
There are hooks to hide standard controls, and then you can add your own customer controls to operate the camera programatically. I have a pet project to make a version of time-lapse, etc.
But for serious projects, Apple suggests using the AV frameworks, and although I haven't started using them, I certainly agree.

UIImagePickerController with timelapse/slowmo in iOS8

Can I add those features to a UIImagePickerController on iOS8?
In the camera app it seems like a native capability - but the question is do such an interface exist?
No, UIImagePickerController doesn't give you the option to record video in Slo Mo, Timelapse or add filters. For that you would have to use a Custom Camera built using the AVFoundation framework.

How to add image picker with camera button to iOS app

I'm adding a button that opens a view of the saved images on device, but also has a button to open the camera. The iOS Facebook app currently does this.
I've played with both AVCapture to create my own camera ui and UIImagePickerController to use the default UI but have been unable to find a view that displays both the saved images and camera button.
My question is, did facebook implement their own image picker or is it an Apple included library?
Thanks!
Facebook has their own imagepicker subclass but that doesnt matter for you - just implement a different method for each button that changes the imagepickertype to UIImagePickerControllerSourceTypeCamera or UIImagePickerControllerSourceTypeSavedPhotosAlbum and then displays the picker.
This came across this control AQPhotoPicker. Hopefully it will help you, it's easy to use

IOS Image Preview Before Using Camera Roll Photo

I have a UIImagePickerController that is used to upload images to a database. It loads photos from two sources, the camera and the camera roll. When I load the photo from the camera it allows me to take a photo and select if I want to retake the photo or use it. When I load the photos from the camera roll I can select what photo library I want to use but only get a tiled preview of all photos in the library. When I click on the tiled photo preview it gets loaded to the database automatically with no full preview. How can I make it so that when I load a photo from the camera roll it allows me to preview the image before using it in a similar fashion to how it loads from the camera? Here is the coe that I use to specify the UIImagePickerController type, data source and initial settings.
UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
imgPicker.delegate = self;
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:imgPicker animated:YES completion:nil];
You have two options:
You can use the allowsEditing property, set it to YES and the final step will be a “preview” of the picked photo. Of course the user can move and scale the photo from that preview, so maybe this is not what you want.
Code your own preview. It will be a simple view controller that you will push into the UIImagePickerController when the user chooses a photo from the gallery. The simplest solution will be just an UIImageView covering all the screen, and two buttons in the navigation bar to choose another photo or choose the previewed one.
Hey thanks for all the help! I ended up using the third party libraries described here: https://github.com/gekitz/GKImagePicker. The GKImagePicker libraries allow you to easily define an editable and scalable area in the same manner as the allowsEditing does.

Resources