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
1
vote
1 answer

Preselecting images with UIImagePickerController

I have a standard code to open image picker, to select multiple images with it: private func openFilesAction() { if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) { let imagePicker = UIImagePickerController() …
Whirlwind
  • 14,286
  • 11
  • 68
  • 157
1
vote
1 answer

Preventing crash after imagePickerController:didFinishPickingMediaWithInfo

I am working on an image filter effects app. A current issue with the app is that it crashes when a user picks a very large image from his photo album. When imagePickerController:didFinishPickingMediaWithInfo returns the selected image, I need to…
adriaan
  • 1,574
  • 14
  • 33
1
vote
2 answers

Crash after having presented UIImagePickerController to photo Library in swift 4 ; Privacy was added to info.plist

crash when access UIImagePickerController with photoLibrary sourceType ; privacy was added to info.plist let myPickerController = UIImagePickerController() myPickerController.delegate = self myPickerController.sourceType =…
Hla Khader
  • 11
  • 3
1
vote
1 answer

How do i make my UIImagePickerController auto rotate?

I tried to sub class the UIImagePickerController and return YES from shouldAutorotateToInterfaceOrientation But this didn't work
1
vote
1 answer

iphone uiimagepickerViewController choosing photolibrary video

Am developing a application which is only selecting video form local photo library and sending it to the server. Here am fixed videoMaximumDuration as 1min..(bcoz am restricting user to choose video less than 1min). when user choosing more than 1min…
nik
  • 2,289
  • 6
  • 37
  • 60
1
vote
2 answers

UIImagePickerController Edited Image - cropping some extra image on top

I'm using UIImagePickerController for profile image and the original image was Now, I'm editing the image in UIImagePickerController as But, the editedImage frame from the UIImagePickerController is slightly different from the image frame what I…
Harsha
  • 760
  • 1
  • 7
  • 21
1
vote
1 answer

Accessing UIImagePickerController Camera's Preview Screen

I am working with a basic UIImagePickerController. I have read about camera overlays and am not ready / don't need to dive into that world yet. After the user takes a photo, the UIImagePickerController displays a "Preview" screen. All I want to do…
Chris
  • 5,485
  • 15
  • 68
  • 130
1
vote
1 answer

How to pass imageView as source to QuickLook preview

After picking an image from UIImagePickerController, I am trying to pass that imageView as a source to QuickLook preview which requires URL as a data source. I am not interested to write the image into any document storage to create a URL, which…
Mukesh
  • 515
  • 7
  • 21
1
vote
0 answers

How do I create a camera app that takes multiple photos swift

I am trying to create an app that takes more than a single photo. What I want is every time​ I take a photo I want the camera opens right after the first photo. import UIKit class ViewController: UIViewController, UIImagePickerControllerDelegate,…
HasanChute
  • 61
  • 1
  • 2
1
vote
2 answers

uiimagepickercontroller video duration - photo library

Am developing a app which will upload video to the server which is picked form local iphone photo library. here i want to restrict the user not to upload more than 3min of video..Question is how to get the duration of the video which is picked from…
nik
  • 2,289
  • 6
  • 37
  • 60
1
vote
1 answer

UIImagePIckerController Selected Image as Base64 String

I am trying to retrieve Base64 string from iOS UIImagePickerController selected event as follows. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { //on selected UIImage…
Umair A.
  • 6,690
  • 20
  • 83
  • 130
1
vote
1 answer

Saving in a DB the path of a photo chosen from the gallery

In my app, I would allow the user to pick a photo from the gallery (or snap a photo/video with the camera). I need to save the path in a db to retrieve it later, but I don't understand how I can do it. ** EDIT ** I didnt' resolve this issue, so now…
1
vote
1 answer

iOS UIImagePickerController and ModalViewController

I have written a piece of code which runs inside PhoneGap based app. The code has a plugin which starts UIImagePickerController when some binded button on web page is clicked using following code. PhotoSelectorCommand.h #import…
Umair A.
  • 6,690
  • 20
  • 83
  • 130
1
vote
1 answer

How to upload image in Swift using Moya?

I have a project where Users select Images from their gallery or snap and it is supposed to be uploaded to a remote server. Now if I try to upload with a static image that I put in my xcode, The image gets uploaded but the moment I use my…
King
  • 1,885
  • 3
  • 27
  • 84
1
vote
1 answer

How to access images taken from camera only in Swift like a gallery in iOS?

In Android we get camera images only i.e. when we open gallery programmatically, but in iOS when we open Photos, we get camera roll images and other unwanted images along with it like whatsapp images. How to filter for only camera images when…
devNewbie
  • 47
  • 1
  • 5