简体   繁体   English

如何在 UIImagePickerController 中禁用视频捕获

[英]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.我正在开发一个允许图像捕获但不允许视频捕获的应用程序,但我不知道如何从 UIImagePickerView 中删除照片/视频切换。 This is the code I'm working with, taken from Apple's documentation:这是我正在使用的代码,取自 Apple 的文档:

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!谢谢!

Or remove this line:或删除此行:

cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera];

The default value for cameraUI.mediaTypes is "kUTTypeImage". cameraUI.mediaTypes 的默认值为“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)您只需将 UIImagePickerController 的 mediaType 属性设置为仅包含图像,您使用的那个用于分配所有可用的媒体类型。如果您不确定类型是什么,您可以在这里阅读他们进行控制台,然后使用适当的数组设置该数组(只允许图片)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在iPhone的UIImagePickerController中捕获视频的缩略图 - how to capture the thumnail of the video in UIImagePickerController in iphone 在没有 UIImagePickerController 的情况下捕获视频 - capture video without UIImagePickerController 调整UIImagePickerController视频捕获界面的大小 - Resize UIImagePickerController video capture interface UIImagePickerController使用相同的实例捕获视频和图像 - UIImagePickerController capture Video and Image with same instance 在没有UIImagePickerController的情况下捕获前端视频Xcode 4(自动) - Capture front video Xcode 4 whithout UIImagePickerController (auto) iPhone使用UIImagePickerController捕获视频中的选择性帧 - iPhone Use UIImagePickerController to capture selective frames from a video 如何在UIImagePickerController中移动相机捕获层 - How to move the camera capture layer in UIImagePickerController iPhone SDK - 如何在UIImagePickerController中禁用图片预览? - iPhone SDK - How to disable the picture preview in UIImagePickerController? UIImagePickerController不会从/ tmp / capture中删除临时视频捕获文件 - UIImagePickerController doesn't delete temp video capture file from /tmp/capture 如何将视频或电影文件显示到UIImagePickerController中? - how to show video or movie file into UIImagePickerController?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM