按下按钮我正在呈现一个AVPlayerViewController: func playVideoPressed(sender: UIButton){ let videoURL = NSURL(string: "someUrl") let player = AVPlayer(URL: videoURL!) let playerViewController = AVPlayerViewController() playerView
func playVideoPressed(sender: UIButton){ let videoURL = NSURL(string: "someUrl") let player = AVPlayer(URL: videoURL!) let playerViewController = AVPlayerViewController() playerViewController.player = player self.presentViewController(playerViewController, animated: true) { playerViewController.player!.play() } }
此AVPlayerViewController的状态栏使当前视图控制器的UI跳转.我可以在此“presentViewController”调用中隐藏状态栏吗?
我试过包括
playerViewController.prefersStatusBarHidden()
但玩家继续显示状态栏.
谢谢
我最终只是创建了一个新的AVPlayerViewController,我从按钮按下,并在该控制器中我添加了代码:override func prefersStatusBarHidden() -> Bool { return true }
看起来像更多的代码,考虑到我只是在观看视频,但它运作顺畅.