首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHPickerViewController添加视频编辑屏幕(又称(UIImagePickerController.allowsEditing = true) )

PHPickerViewController添加视频编辑屏幕(又称(UIImagePickerController.allowsEditing = true) )
EN

Stack Overflow用户
提问于 2020-12-19 22:17:10
回答 1查看 617关注 0票数 1

我想在选择后编辑/压缩视频,就像在UIImagePickerController中使用allowsEditing = true一样。

尽管如此,新的PHPickerViewController没有这个属性,Applehere不再有这样的属性。但是在应用商店中,有一些应用在从PHPickerViewController中选择资产后,会推送"allowsEditing控制器“

下面是我的PHPickerViewController实现:

代码语言:javascript
复制
func openImagePicker() {
        if #available(iOS 14, *) {
            var configuration = PHPickerConfiguration()
            configuration.preferredAssetRepresentationMode = .automatic
            let picker = PHPickerViewController(configuration: configuration)

            // Set the delegate
            picker.delegate = self
            // Present the picker

            present(picker, animated: true)
        } else {
            // Fallback on earlier versions
            imagePicker?.photoGalleryAsscessRequest()
        }
    }

extension EditController: PHPickerViewControllerDelegate {
    @available(iOS 14, *)
    func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
        self.dismiss(animated: true)
   }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-29 07:36:04

我调查了这个问题,但确实不支持您提到的allowsediting

例如,与您的问题相关,视频编辑的预设值被折旧为UIImagePickerController.ImageURLExportPreset.compatible,但不支持自动压缩。拾取器将始终传递原始视频/图像,并由应用程序进行必要的压缩或编辑。你可以查看苹果的文档:imageExportPreset

苹果特别提到,我们应该使用这款新的UIImagePickerViewController,而不是旧的should。如果有人想知道更多:Meet the new Photos picker

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65370729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档