iphone - 如何在 UIImagePickerController 中禁用视频捕获

标签 iphone objective-c ios camera

我正在开发一个允许图像捕获但不允许视频捕获的应用程序,但我不知道如何从 UIImagePickerView 中删除照片/视频切换。这是我正在使用的代码,摘自 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];

除了照片/视频开关,我想保留所有相机控件。谢谢!

最佳答案

或者删除这一行:

cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera];

cameraUI.mediaTypes 的默认值为“kUTTypeImage”。查看documentation .

关于iphone - 如何在 UIImagePickerController 中禁用视频捕获,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6600723/

相关文章:

objective-c - 用Cocos2d绘制CGRect

objective-c - 如何检查 NSString 是否以某个字符开头

返回 Firebase 用户名时的 iOS 异步任务问题

iphone - URL 连接 : What is the difference between the following?

iphone - UISearchDisplayController - 如何仅选择范围按钮但搜索字符串为空来显示搜索结果

objective-c - Objective-C 中字符串与数组元素的串联

ios - 在 Facebook iOS SDK 4.0 上显式分享

iphone - SendDelegateMessage 等待10秒后返回失败

iphone - 以模式动态排列图像 - iOS

iphone - cocos2d Sprite 当前位置