【问题标题】:How can I dismiss `custominfoviewcontroller` programatically on tvOS?如何在 tvOS 上以编程方式关闭“自定义信息视图控制器”?
【发布时间】:2018-08-19 17:46:13
【问题描述】:
在 tvOS 11.0+ 上,custominfoviewcontroller 被添加到 AVPlayerViewController。我的问题是如何在我的自定义信息视图控制器中选择某些内容后关闭整个信息面板?
我尝试使用dismiss(animated: true, completion: nil)。虽然它确实关闭了信息面板,但在我尝试立即向下滑动后,信息面板不会再次显示。
【问题讨论】:
标签:
tvos
avplayerviewcontroller
【解决方案1】:
您需要将PlayerCustomInfoViewController 添加到播放器的customInfoViewController
有点像
// If you have created a `MainViewController` as a subclass of `AVPlayerViewController`
self.customInfoViewController = PlayerCustomInfoViewController(initalize parameter)..
一旦你在PlayerCustomInfoViewController 上选择了所需的信息,那么你需要将调用返回到你实现播放器的控制器(MainViewController)。
然后从那里你解雇customInfoViewController.dismiss()
我也试过了,效果很好。