我试图仅在imagePickerController中显示视频图块。我了解您必须更改mediaType,而我已经做到了。我想要的是仅显示视频图块,而不显示相机胶卷和您在此处看到的瞬间
我只想要一个视频平铺,如这张图片所示。我不需要点击相机胶卷然后观看视频。我只想要一个单独的视频图块,可以清楚地看到其中只有视频。
我为图像选择器添加了控制器
/// Selector Controller used to pick an image
open class ImagePickerController : UIImagePickerController, TypedRowControllerType, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
/// The row that pushed or presented this controller
public var row: RowOf<URL>!
/// A closure to be called when the controller disappears.
public var onDismissCallback : ((UIViewController) -> ())?
open override func viewDidLoad() {
super.viewDidLoad()
delegate = self
allowsEditing = (row as? _VideoRow)?.allowEditor ?? false
mediaTypes = [kUTTypeMovie as String, kUTTypeVideo as String]
}
public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
guard let videoURL = info[UIImagePickerControllerMediaURL] as? URL else {
return
}
(row as? _VideoRow)?.videoURL = videoURL
(row as? _VideoRow)?.value = videoURL
onDismissCallback?(self)
}
open func imagePickerControllerDidCancel(_ picker: UIImagePickerController){
onDismissCallback?(self)
}
private func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
self.navigationItem.title = "Videos"
}
}
为什么我不能更改标题
答案 0 :(得分:0)
我想要的是仅显示视频图块,而不显示相机胶卷和您在此处看到的瞬间
然后不要使用UIImagePickerController;编写自己的选择器。如果使用UIImagePickerController,则只能使用它提供的功能。它为您提供了源类型.photoLibrary
和.savedPhotosAlbum
,仅此而已。