gpt4 book ai didi

ios - 仅在 UIImagePickerController 中显示视频

转载 作者:技术小花猫 更新时间:2023-10-29 11:18:48 26 4
gpt4 key购买 nike

我正在使用以下代码来呈现 UIImagePickerController。对于某些特定场景,我只需要视频。并使用以下代码。

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
imagePickerController.allowsEditing=NO;

imagePickerController.mediaTypes=[[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie,nil];

[self presentViewController:imagePickerController animated:YES completion:nil];

但它在表格 View 中显示相机胶卷、我的照片流和视频。如果我打开任何文件夹,内容只是视频。我只想要视频我怎么能做到这一点。还有标题照片,我也想改变它到视频。

最佳答案

swift 3 更新:

let videoPicker = UIImagePickerController()  
videoPicker.delegate = self
videoPicker.sourceType = .photoLibrary
videoPicker.mediaTypes = [kUTTypeMovie as String]
self.present(videoPicker, animated: true, completion: nil)

导入 导入 MobileCoreServices 并在顶部添加委托(delegate) UIImagePickerControllerDelegateUINavigationControllerDelegate

呈现的模式将具有“照片”标题。您可以这样更改它:

func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
viewController.navigationItem.title = "Choose Video"
}

关于ios - 仅在 UIImagePickerController 中显示视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23112088/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com