How to display UIVideoEditorViewController full screen in iPad

821 Views Asked by At

I have used UIVideoEditorViewController for trimming selected video. The problem is that the editorController has to be presented in popover style in iPad. When I running it on iPad, the editor view on pop over the left corner instead of the full screen. Is there any way to make the popover view in full screen size? Thanks

    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)

    }
1

There are 1 best solutions below

1
On

There is no way to show UIVideoEditorController full screen. You can put it inside some container controller. And then configure this container controller preferredContentSize with screen bounds. You will get almost full-screen size popover.

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)