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
37
votes
7 answers

iPhone, "More than maximum 5 filtered album lists trying to register. This will fail." Error

When I try to read an image from the photo library I get the error, "More than maximum 5 filtered album lists trying to register. This will fail." The image is not read. Any idea how to fix this?
SolidSnake4444
  • 3,372
  • 6
  • 40
  • 63
37
votes
7 answers

how to capture camera with UIImagePickerController in swift?

I'm trying use UIImagePickerController in swift but isn't work... my ViewController: class ViewController: UIViewController { @IBOutlet var imag : UIView = nil @IBAction func capture(sender : UIButton) { println("Button capture") if…
user3745888
  • 6,143
  • 15
  • 48
  • 97
36
votes
7 answers

iOS 8 SDK: modal UIWebView and camera/image picker

I have found that, when compiling for iOS 8 (and running in iOS 8), a UIWebView cannot show the camera/image picker if the UIWebView is in a view controller presented modally. It works without problem in view controllers directly “hanging” from the…
yonosoytu
  • 3,319
  • 1
  • 17
  • 23
35
votes
4 answers

Resizing UIimages pulled from the Camera also ROTATES the UIimage?

I am getting UIimages from the camera and assigning them to UIImageViews to be displayed. When I do this the camera gives me a 1200 x 1600 pixel image which I then assign to a UIImageView in my Application. The image is displayed as expected in the…
RexOnRoids
  • 14,002
  • 33
  • 96
  • 136
32
votes
7 answers

UIImagePickerController on iPad with IOS9

Since iOS 9 and Xcode 7 I am no longer able to implemet a UIImagePickerController on an iPad (both device and simulator). The code below works on the iPad but only prior to iOS 9. When using iOS 9+ the presented image (after the…
pete
  • 2,980
  • 4
  • 22
  • 34
32
votes
6 answers

iOS7 iPad Landscape only app, using UIImagePickerController

I believe this is a common issue and many answers don't work anymore, many just partial, if you are under iOS7 and your iPad app is Landscape only, but you want to use the UIImagePickerController with source…
32
votes
9 answers

Using UIImagePickerController in landscape orientation

I am creating an app which is in landscape mode and I am using UIImagePickerController to take photos using iPhone camera in it and I want to create it in landscape mode too. But as the Apple documention suggests UIImagePickerController does not…
32
votes
5 answers

How to select any Video or Movie file from UIImagePickerController

In my app, i need to select any video file and show the display the url for a video file in the application. -(void)viewDidLoad{ [super viewDidLoad]; self.imgPicker = [[UIImagePickerController alloc] init]; self.imgPicker.delegate =…
user1379448
  • 327
  • 1
  • 4
  • 8
30
votes
8 answers

didFinishPickingMediaWithInfo return nil photo

I am working to capture an image that is returned in 4.0 using - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [[picker parentViewController]…
Rob Bonner
  • 9,276
  • 8
  • 35
  • 55
29
votes
2 answers

iPhone - UIImagePickerControllerDelegate inheritance

I have added a UIImagePickerController to a UIViewController. I have also assigned the UIImagePickerControllerDelegate to that UIViewController. When I execute the following line, myPicker.delegate = self; Xcode gifts me with the following…
28
votes
3 answers

how to change the UIImagePickerController crop frame

when opening working with an UIImagePickerController and setting allowsImageEditing = YES; there is a default cropping frame that is 320x320. In my case, I would like to setup that cropping frame to 320x240 for images that are landscape, and…
user123404
  • 281
  • 1
  • 3
  • 4
28
votes
7 answers

iPhone video recording: "cameraCaptureMode 1 not available because mediaTypes does contain public.movie"

I tried to record a video. The message I got is from the following code on the device: UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.sourceType =…
Danail
  • 10,443
  • 12
  • 54
  • 76
28
votes
8 answers

How do you color/customize the UIImagePickerController's Navigation Bar?

What is the correct way to color the UIImagePickerController's nav bar? I merely tried to see the background color but I'm getting a faded color as seen in the image below; as if some view is obstructing it. let picker =…
Frederick C. Lee
  • 9,019
  • 17
  • 64
  • 105
27
votes
8 answers

Getting URL of UIImage selected from UIImagePickerController

I'm trying to provide a user selection of an image from Photo Library. Thus I'm using UIImagePickerController for selecting. But here comes an issue with getting its initial URL in the file system (I need this for CKAsset). My code. func…
mozharovsky
  • 1,255
  • 2
  • 18
  • 25
27
votes
1 answer

iOS - How to customize the crop rect in UIImagePickerController with allowsEditing on?

Is there any way to define the crop area rect using the camera image picker?
dan
  • 5,377
  • 13
  • 39
  • 44