我正在开发一个允许图像捕获但不允许视频捕获的应用程序,但我不知道如何从 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/