Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable video capture in UIImagePickerController

I'm working on an app that allows image capture, but not video capture, but I can't figure out how to remove the photo/video toggle from a UIImagePickerView. This is the code I'm working with, taken from Apple's documentation:

UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;

// Displays a control that allows the user to choose picture or
// movie capture, if both are available:
cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera];

// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
cameraUI.allowsEditing = NO;

cameraUI.delegate = self;

[self presentModalViewController:cameraUI animated:YES];

I'd like to keep all the camera controls EXCEPT the photo/video switch. Thanks!

like image 862
dnorcott Avatar asked Jul 06 '11 17:07

dnorcott


1 Answers

Or remove this line:

cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera];

The default value for cameraUI.mediaTypes is "kUTTypeImage". See the documentation.

like image 79
Saritwat Jorlek Avatar answered Sep 20 '22 18:09

Saritwat Jorlek