Questions tagged [uiimagepickercontroller]

Questions related to the iOS UIImagePickerController class (and the associated UIImagePickerControllerDelegate protocol), which provides system-supplied user interfaces for taking pictures and movies on iOS devices, and for choosing saved images and movies.

The UIImagePickerController class manages customizable, system-supplied user interfaces for taking pictures and movies on supported devices, and for choosing saved images and movies for use in your app. An image picker controller manages user interactions and delivers the results of those interactions to a delegate object.

The role and appearance of an image picker controller depend on the source type you assign to it before you present it.

  • A sourceType of UIImagePickerControllerSourceTypeCamera provides a user interface for taking a new picture or movie (on devices that support media capture).
  • A sourceType of UIImagePickerControllerSourceTypePhotoLibrary or
    UIImagePickerControllerSourceTypeSavedPhotosAlbum provides a user
    interface for choosing among saved pictures and movies.

To use an image picker controller containing its default controls, perform these steps:

  1. Verify that the device is capable of picking content from the desired source. Do this calling the isSourceTypeAvailable: class method, providing a constant from the “UIImagePickerControllerSourceType” enum.
  2. Check which media types are available, for the source type you’re using, by calling the availableMediaTypesForSourceType: class method. This lets you distinguish between a camera that can be used for video recording and one that can be used only for still images.
  3. Tell the image picker controller to adjust the UI according to the media types you want to make available—still images, movies, or both—by setting the mediaTypes property.
  4. Present the user interface by calling the presentViewController:animated:completion: method of the currently active view controller, passing your configured image picker controller as the new view controller. On iPad, present the user interface using a popover. Doing so is valid only if the sourceType property of the image picker controller is set to UIImagePickerControllerSourceTypeCamera. To use a popover controller, use the methods described in “Presenting and Dismissing the Popover” in UIPopoverController Class Reference.
  5. When the user taps a button to pick a newly-captured or saved image or movie, or cancels the operation, dismiss the image picker using your delegate object. For newly-captured media, your delegate can then save it to the Camera Roll on the device. For previously-saved media, your delegate can then use the image data according to the purpose of your app.

    For details on these steps, refer to Apple's “Taking Pictures and Movies”.

4123 questions
22
votes
10 answers

Picker Error Message on Exit (encountered while discovering extensions: Error Domain=PlugInKit Code=13) With Swift 4 - Xcode 9

Similar to PhotoPicker discovery error: Error Domain=PlugInKit Code=13 and also to https://forums.developer.apple.com/thread/82105 BUT I have tried all of these suggestions and still get an error in the debug log. Running Swift 4 XCode 9A235 What…
john
  • 505
  • 1
  • 7
  • 15
22
votes
6 answers

iOS SDK - How to get the status bar back when using UIImagePickerController?

As soon as I add a UIImagePickerController sub view to my view the status bar disappears and I can't get it back. Is there any way to keep the status bar visible? UIImagePickerController *imagePicker = [[UIImagePickerController alloc]…
dan
  • 1,067
  • 3
  • 11
  • 17
22
votes
7 answers

Received memory warning. Level=1 when showing a UIImagePickerController

This is driving me crazy!!! I'm getting a "Received memory warning. Level=1" whenever I attempt to show a UIImagePickerController with a sourceType = UIImagePickerControllerSourceTypeCamera. Here is the code from my viewDidLoad where I set things…
wgpubs
  • 8,131
  • 15
  • 62
  • 109
21
votes
1 answer

Camera Overlay with User-Photo not saving as edited

I am using a transparent image with a cut out for a user to insert / take their own image. For some reason, while using the UIImagePickerControllerEditedImage and cropping the user-taken photo, the image does not save as it was edited; see photo for…
WrightsCS
  • 50,551
  • 22
  • 134
  • 186
21
votes
3 answers

Objective C: How to fix aspect ratio of image (and not change to fit imageview frame)

I am using the UIImagePickerController to select images for my app. However I am facing some challenges with regards to maintaining aspect ratio of the selected images For example, I have a raw image on the phone as follows (not square…
Zhen
  • 12,361
  • 38
  • 122
  • 199
21
votes
3 answers

Range slider's touch (box) of video trimmer "off"

I am using FDTake (the pod wont be too important for this question but still) to select videos from Photos which works fine. However, I would also like to be able to edit videos and limit their length to about 12 seconds. To do so I looked at the…
Moritz
  • 745
  • 1
  • 10
  • 32
21
votes
6 answers

UIImagePickerController AllowsEditing not working

I am using UIImagePickerController to allow the user to take a picture. I want to allow him/her to edit it afterwards but, whatever I do, I get nothing. Here is my code (I am using Xamarin): UIImagePickerController imagePicker = new…
Amit Raz
  • 5,370
  • 8
  • 36
  • 63
21
votes
7 answers

iOS 7 UIImagePickerController has black preview

I have a UIImagePickerController being called with sourceType camera and 80% of the time I get a black preview. If I wait, let's say around 30 seconds, I get a good preview and it will be good for around 50% of the time, then it can break again. The…
Heavy_Bullets
  • 518
  • 1
  • 4
  • 13
21
votes
2 answers

UIImagePickerController how to do animated switch from rear to front camera?

I have been using custom overlay for UIImagePickerController controller, and everything is working fine. I have added button to switch between front and rear camera via - - (IBAction)changeCamera:(id)sender { if (self.imagePicker.cameraDevice ==…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
20
votes
4 answers

How to use UIImagePickerController in iPad?

Hi i am working on a universal application (iPhone/iPad). one feature is that i have to select a photo from album and show it on UIImageView. Now problem is that it is working good on iPhone but when i try to open photo album it crashes. my code in…
Mashhadi
  • 3,004
  • 3
  • 46
  • 80
20
votes
4 answers

UIImagePickerController crashes on iOS10

On presenting UIImagePickerController with photo library source on iOS10, my app crashes. On iOS10 with camera source and on iOS9 with photo library and camera sources, the app does not crash. The app is written in Swift 2.2 and built by Xcode…
r.izumita
  • 450
  • 1
  • 4
  • 13
20
votes
2 answers

UIImagePickerController with allowsEditing doesn't allow panning to crop

I saw this question here: UIImagePicker allowsEditing stuck in center It seems someone had this problem before, but there's no clear resolution. Reproduction steps: Set allowsEditing = YES Take a picture Crop window comes up, but everytime I pan…
chrysb
  • 1,351
  • 2
  • 13
  • 20
19
votes
3 answers

UIImagePickerController - crops picture to square (in portrait)

I'm using the UIImagePickerController to take and edit a picture. it works fine in landscape, but in portrait it will crop the picture into a square (does not allow to reduce the image to fit fully into the square crop field like in landscape. Any…
cabhara
  • 463
  • 1
  • 4
  • 14
19
votes
7 answers

iPhone Camera Iris / Shutter stuck in closed position

As the title states the app that I am developing has an issue that is caused only when the app is relaunched after entering the background. The camera iris or shutter gets stuck in the closed position. The funny thing is you can still take a picture…
dana0550
  • 1,125
  • 1
  • 9
  • 16
19
votes
4 answers

iPhone - UIImagePickerController -> save the image to app folder

I have an iPhone application using a UIImagePickerController. As sourceType I have UIImagePickerControllerSourceTypePhotoLibrary UIImagePickerControllerSourceTypeCamera UIImagePickerControllerSourceTypeSavedPhotosAlbum so the user can make a…
Tim
  • 13,228
  • 36
  • 108
  • 159