IOS 11 UIImagepicker for video如何将滑块移动到底部?

时间:2017-10-06 06:57:02

标签: swift uiimagepickercontroller

如果将带有mediatype的UIImagepicker设置为video并将allowEditing设置为true, 顶部的滑块在左侧不可触摸。 所以我不能裁剪视频的开头。

它完美地在IOS10中工作,但是在iOS11中,它会变成错误的。

如何将滑块移动到底部,就像Apple在照片中所做的那样?

这是我的代码:

class func shouldStartVideoLibrary(_ target: AnyObject, canEdit: Bool) -> Bool {
    if !UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.photoLibrary) && !UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.savedPhotosAlbum) {
        return false
    }

    let type = kUTTypeMovie as String
    let imagePicker = UIImagePickerController()

    if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.photoLibrary) && (UIImagePickerController.availableMediaTypes(for: UIImagePickerControllerSourceType.photoLibrary) as [String]!).contains(type) {
        imagePicker.mediaTypes = [type]
        imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary
    }
    else if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.savedPhotosAlbum) && (UIImagePickerController.availableMediaTypes(for: UIImagePickerControllerSourceType.savedPhotosAlbum) as [String]!).contains(type) {
        imagePicker.mediaTypes = [type]
        imagePicker.sourceType = UIImagePickerControllerSourceType.savedPhotosAlbum
    }
    else {
        return false
    }

    imagePicker.allowsEditing = canEdit
    imagePicker.videoMaximumDuration = 240.0
    imagePicker.delegate = target as! ChatViewController
    target.present(imagePicker, animated: true, completion: nil)

    return true
}

0 个答案:

没有答案