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
2 answers

Swift, load video of the gallery without compression

When you offer the possibility to a user to use a video previously registered in the gallery of the iPhone with a UIImagePickerController, it's imported and compressed to 1280x720 regardless of the original resolution. Is it possible to get the…
Mathieu Robert
  • 325
  • 1
  • 5
  • 17
1
vote
0 answers

Issue recovering filename from PHAsset in iOS 13.3

I am working on an App showing an Info Panel based on pictograms. I am given the user the option to select a pictogram from Photo Library and showing it in the App. As part of the process I am recovering the filename, so that I am able to present…
grodfue
  • 11
  • 3
1
vote
0 answers

Add UIImagePickerController to a kivy-ios-app (Python)

I want to access my images/photo gallery on an iOS device from a kivy application. Kivy has no native way implemented to do this, so I'm trying to solve it with kivy/pyobjus where I can use the UIImagePickerController (from Apples UIKit). from…
deveb
  • 11
  • 2
1
vote
2 answers

Avoiding to save image duplicates

My app allow users to choose imgs and associate them to some text. When the user choose an image from the photo roll, I copy it in the Documents directory. As the user should choose the same img associating it to the same text or another one, how…
1
vote
0 answers

Custom showsCameraControls for UIImagePickerControllerSourceTypeCamera

I want to add two extra buttons to my UIImagePickerController. I saw that done in an app: camwow but I couldn't find the documentation to do that. I have a view overlay over the UIImagePickerControllerSourceTypeCamera but at the moment touches on…
321zeno
  • 1,264
  • 1
  • 12
  • 24
1
vote
1 answer

purgeMemoryForReason for Camera Control UIImagePickerViewController

I am developing a small application with Custom Camera control . Its working verry well with all functionality without any Leak in Memory But when i try to access camera more than 8-9 times, application crash ... I checked with Performance tool…
Darshan Shah
  • 61
  • 2
  • 8
1
vote
1 answer

UIImagePickerController video maximun size

I am using a UIImagePickerController to record a video and I need a video with max duration of 30 sec or max size of 40 MB. By default i have set it videoMaximumDuration, but I don't know how to restrict the maximum size of a video and is there any…
user10579845
1
vote
2 answers

Can't load camera using SwiftUI

I have 2 buttons, one to load an image from the gallery and one to load from the camera (i.e. take photo). But no matter what I try I keep getting gallery load instead of the camera. I've been using the following code (from my google searches) in my…
YogiBear
  • 51
  • 1
  • 8
1
vote
1 answer

UiImagePickerController - Additional Preview Screen With Overlay

The latest "Yelp" app provides "Add Business Photo" functionality. After taking a photo the preview screen is displayed as usual. However tapping the "use" button displays what appears to be the same preview screen with an overlay containing buttons…
imobilizer
  • 161
  • 1
  • 13
1
vote
1 answer

Updating Nav Bar background when displaying UIImagePickerController

In my AppDelegate I configure my navigation bar as follows: func setupNavBar() { let barAppearance = UINavigationBar.appearance() barAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: appRed] …
1
vote
1 answer

Get Image URL of photo with UIImagePickerControllerDelegate

I am using UIImagePickerController to select images. I was hoping to get the local path too. I am doing this for images in an album using info[UIImagePickerController.InfoKey.imageURL] as? URL In the case of an image using the camera this is nil…
Teddy K
  • 820
  • 1
  • 6
  • 17
1
vote
2 answers

iOS 13 UIImagePickerController Image/Video grid goes behind navigation bar

I am having an issue with UIImagePickerController. I'm presenting as Fullscreen. The issue is the images grid goes behind the navigation bar. I have even tried a new appearance proxy thing but no luck. Here is a link to the video of the…
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256
1
vote
1 answer

UIImagePickerController doesn't return a live photo in iOS 13

My code has stopped working in iOS 13. In my UIImagePickerController delegate I look to see if the media type returned (the type of thing the user chose) is a live photo. If it is, I use the .livePhoto key to get the PHLivePhoto. This used to work.…
matt
  • 515,959
  • 87
  • 875
  • 1,141
1
vote
1 answer

UIImagePickerController: How to allow editing but hide crop option

I want to pick an image from the gallery and show the preview for a user asking him/her to cancel/chose the image. I can achieve this using the allowsEditing option but I want to hide the square crop that is displayed to the user, instead I just…
Mahi Tej Gvp
  • 984
  • 1
  • 14
  • 34
1
vote
1 answer

UIImagePickerController via UIPopoverController

I just received an error when trying to present a UIImagePickerController modally. The error essentially stated I needed to show the ImagePicker using a UIPopoverController. My problem is I am already in a UIPopoverController, and the error is…
SSS
  • 179
  • 2
  • 10