开发者

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 = [[UIImage开发者_StackOverflowPickerController 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!


Or remove this line:

cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera];

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


You just have to set the mediaType property of UIImagePickerController to only contain images, the one you are using there is used to assign all available media types..you can read about it here, if you arent sure what the types are you can always output them to console and then just set that array with the appropriate one (to allow only pictures)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜