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
19
votes
6 answers

Swift - How to record video in MP4 format with UIImagePickerController?

I am creating a app in which i need to record videos and upload it to a server. Now my project has a android version too. To support android version i have to record the videos in mp4 format. I followed this tutorial to set the UIImagePicker media…
Kautham Krishna
  • 967
  • 1
  • 14
  • 33
19
votes
5 answers

Avoid Video Compression when Selecting Movie with UIImagePickerController?

I'm using UIImagePickerController to allow my user to select a video from the asset library. When the user selects the "Choose" button on the second screen, the view displays a progress bar and a "Compressing Video..." message. Why is this…
Avalanchis
  • 4,500
  • 3
  • 39
  • 48
19
votes
5 answers

How to select a portion of an image, crop, and save it using Swift?

I am trying to create an iOS app using Swift to capture images and let the user save a selected portion of the image. In many cam based apps, I noticed that a rectangular frame is offered to let the users choose the desired portion. This involves…
Sriram
  • 999
  • 2
  • 12
  • 29
19
votes
2 answers

UIImagePicker cameraOverlayView appears on Retake screen

I am struggling with a problem. I am capturing a video, and i had put an UIImageView with an UIImage in it as the UIImagePicker CameraOverLay. So when the user starts the camera in order to capture a video, he can see an overlay on the camera. When…
Raz
  • 2,633
  • 1
  • 24
  • 44
19
votes
8 answers

Select Multiple Images (UIImagePickerController or Photos.app Share UI)

In iPhone OS 3.0, Apple added the ability to share multiple pictures at once using the "Share" button and selecting multiple images (where a checkmark is used). I'd love to have a UIImagePickerController which lets the user select multiple images…
Itay
  • 1,669
  • 5
  • 18
  • 23
18
votes
5 answers

Enabling the photo library button on the UIImagePickerController

Does anyone know how to enable the photo album button on the UIImagePickerController when its in the camera mode? Like how the camera app on on the iphone can toggle between image and video taking and also has the button to view the photo library?
MBU
  • 4,998
  • 12
  • 59
  • 98
18
votes
6 answers

Creating an image format with an unknown type is an error Objective-C Xcode 8

While choosing an image from the image picker in iOS 10 Objective-C and Xcode 8. I am getting an error - Creating an image format with an unknown type is an error . It was ok for the previous version. Here is my code: UIImagePickerController*…
riaz hasan
  • 1,155
  • 2
  • 8
  • 20
18
votes
5 answers

UIImagePickerController exception : "Source type must be UIImagePickerControllerSourceTypeCamera"

what is wrong with this? I really don't understand some important parts for UIImagePickerController.... here's the source: UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.sourceType…
Danail
  • 10,443
  • 12
  • 54
  • 76
18
votes
6 answers

How do I mirror a UIImage picture from UIImagePickerController

I'm trying to figure out if there is any way to mirror an image. For example, take a picture of someone's face and then cut it in half and show what their face looks like with each side mirrored. There doesn't seem to be any tricks like this in…
Terry
  • 181
  • 1
  • 1
  • 3
18
votes
2 answers

How to Skip Retake/Use Photo option after capturing image by camera in IOS 7

Here I am developing an app using IOS 7 in which camera used to capture the image. but after capturing image it displaying Retake/Use Photo options. i want that after capturing image it directly go to next screen without showing default Retake?use…
Aabasaheb Deshpande
  • 399
  • 1
  • 3
  • 13
18
votes
4 answers

UIImagePickerController throws ERROR: 185: Error creating aggregate audio device: 'what' when trying to select video

when i try to use UIImagePickerController to select a video from camera roll in the iOS-Simulator of XCode 5, i get the aforementioned error. this is the output: 2013-11-02 21:28:44.788 Imagepicker[89146:1403] 21:28:44.788 ERROR: 185: Error…
Brett Schneider
  • 3,993
  • 2
  • 16
  • 33
17
votes
1 answer

Why can’t UIImagePickerController be pushed into navigation stack?

When using pushViewController to push UIImagePickerController: [self.navigationController pushViewController:pvc animated:YES]; an error will occur such as: Pushing a navigation controller is not supported The right solution is to use…
17
votes
2 answers

iPhone SDK - How to disable the picture preview in UIImagePickerController?

Is there any way to disable the image preview after taking a picture with the UIImagePickerController? I want to dismiss the ImagePicker as soon as the user pressed the shutter release button.
dan
  • 5,377
  • 13
  • 39
  • 44
17
votes
5 answers

UIImagePickerController editing view circle overlay

I've been able to get pretty far with what I've been wanting to accomplish, and that's to replicate iOS's built in circular photo cropper for the built in contacts app. However, I'm stuck at trying to get my CAShapeLayers made correctly. I'm trying…
klcjr89
  • 5,862
  • 10
  • 58
  • 91
16
votes
6 answers

Swift 4.2 Cannot convert value of type '(UIImagePickerController.InfoKey).Type' to expected argument type 'UIImagePickerController.InfoKey'

My below code was working just fine with swift 4 but after upgrading to swift 4.2 I am getting this error, I had wasted my 3 hours searching what's the issue but failed. Please if anyone can guide me how to fix this. func imagePickerController(_…
Muhammad Khan
  • 284
  • 1
  • 3
  • 12