2

我使用 UIVideoEditorViewController 修剪选定的视频。问题是 editorController 必须在 iPad 中以 popover 样式呈现。当我在 iPad 上运行它时,编辑器视图弹出左角而不是全屏。有什么办法可以使弹出视图全屏显示?谢谢

    if UIVideoEditorController.canEditVideoAtPath(tmp) {
        editVideoViewController = self.storyboard?.instantiateViewControllerWithIdentifier("editorVC") as! EditorViewController
        editVideoViewController.delegate = self
        editVideoViewController.videoPath = tmp
        editVideoViewController.videoMaximumDuration = 30
        editVideoViewController.videoQuality = .TypeHigh
        editVideoViewController.modalPresentationStyle = UIModalPresentationStyle.Popover

        editVideoViewController.popoverPresentationController?.sourceView = editVideoViewController.view

        self.presentViewController(editVideoViewController, animated: true, completion: nil)

    }
4

1 回答 1

3

没有办法显示UIVideoEditorController全屏。您可以将其放在某个container控制器中。preferredContentSize然后用屏幕边界配置这个容器控制器。您将获得几乎全屏大小的弹出框。

let containerVC = UIViewController()
containerVC.preferredContentSize = UIScreen.main.bounds.size
containerVC.modalPresentationStyle = .popover
let ppc = containerVC.popoverPresentationController
ppc?.delegate = self
ppc?.sourceView = containerVC.view
ppc?.sourceRect = UIScreen.main.bounds
ppc?.permittedArrowDirections = .init(rawValue: 0 )
ppc?.canOverlapSourceViewRect = true

let videoController = UIVideoEditorController()

containerVC.addChild(videoController)
containerVC.view.addSubview(videoController.view)
videoController.didMove(toParent: containerVC)

self.present(containerVC, animated: true)
于 2019-07-24T09:01:43.740 回答