我想在选择后编辑/压缩视频,就像UIImagePickerController
在allowsEditing = true
.
新的仍然PHPickerViewController
没有这个属性,并Apple
说这里不再有这个属性。但是 App Store 中有应用程序在选择资产后推送“allowsEditing 控制器”PHPickerViewController
这是我的 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)
}
}