【问题标题】:PHPickerViewController add video editing screen aka (UIImagePickerController.allowsEditing = true)PHPickerViewController 添加视频编辑屏幕 aka (UIImagePickerController.allowsEditing = true)
【发布时间】:2020-12-19 14:17:10
【问题描述】:

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

新的PHPickerViewController 仍然没有此属性,Apple 表示不再有此属性here。但是 App Store 中有应用程序在从PHPickerViewController 选择资产后推送“allowsEditing 控制器”

这是我的 PHPickerViewController 实现:

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)
   }
}

【问题讨论】:

  • 可以分享 App Store 中的应用链接吗?

标签: ios swift swiftui uiimagepickercontroller phpickerviewcontroller


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 2013-08-13
    • 2021-01-21
    • 2012-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多