【发布时间】:2020-12-19 14:17:10
【问题描述】:
我想在选择后编辑/压缩视频,就像在 UIImagePickerController 和 allowsEditing = 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