问题
Note that this problem occurs specifically in iOS 13. The same code and structure works perfectly on iOS 10~12. The app plays video on a UIViewController that is pushed into the UINavigationViewController. The video plays fine and goes to full screen as usual but when I press the done button to exit the fullscreen, the entire stack of UIViewControllers gets popped and it lands in the home view.
I'm using xib, swift 5, Xcode 11
Here's the code where I create the player and play the video:
let playerController = AVPlayerViewController()
playerController.player = player
addChild(playerController)
playerView.addSubview(playerController.view)
playerController.view.frame = playerView.frame //playerView is a UIView in my UIViewController
player.play()
I want just want to exit full screen while staying on the same UIViewController. Here's a Screenshot. I hope this helps.
来源:https://stackoverflow.com/questions/58116399/avplayerviewcontroller-pops-all-uiviewcontrollers-from-uinavigationcontroller-wh