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:
- Add the
MobileCoreServices
framework to your project. - In the header file that is used to create the UIImagePickerController, add
#import <MobileCoreServices/UTCoreTypes.h>
- 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.