0

UIPickerViewController用来从设备相机胶卷中选择图像和视频。当我选择视频时,我想选择一个最长 10 秒的视频,如果更长,以便用户可以修剪它。

到目前为止,我已经在网上搜索并做到了这一点,但它似乎不起作用:

let imagePickerController = UIImagePickerController()
    imagePickerController.videoMaximumDuration = 10.0
    imagePickerController.mediaTypes = ["public.image", "public.movie"]
    imagePickerController.delegate = self
    self.present(imagePickerController, animated: true, completion: nil)
4

1 回答 1

1

我找到了解决方案,您需要做的就是在演示之前添加这一行:

imagePickerController.allowsEditing = true
于 2021-06-18T14:45:19.830 回答