【发布时间】:2018-10-17 23:57:20
【问题描述】:
我试图仅在我的 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"
}
}
还有为什么不能改标题
【问题讨论】:
标签: ios swift uiimagepickercontroller