Luke Ryan Jernejcic

Set the UIImagePickerController to still photos only

March 18, 2012

Working on my iPhone app today I came across the need to setup the camera to only take still photos, and therefore ignore videos and hide the video camera. The Apple docs mention that to do this you just set the mediaTypes attributes to only [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil]. Unfortunately it’s a bit of a pain to figure out just how to pull in kUTTTypeImage. Here’s how you do it:

  1. Add the MobileCoreServices framework to your project.
  2. In the header file that is used to create the UIImagePickerController, add #import <MobileCoreServices/UTCoreTypes.h>
  3. User cameraUI.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil];

I hope that helps. You can also use kUTTypeVideo is you want to use only video and not include still images.


Written by Luke Ryan Jernejcic who lives and works in Austin Texas building useful things. Follow him on Twitter