modalPresentationStyle 命令不会更改为全屏

modalPresentationStyle command Doesn't change to fullscreen

我正在 Xcode 11 上使用故事板制作游戏,我有两个故事板用于游戏,如果你输了。我的问题是默认显示是模态的而不是全屏的,所以我做了一些研究并发现了这个

vc.modalPresentationStyle = .fullScreen
self.present(vc, animated: true, completion: nil)

所以我尝试将其放入我结束游戏的函数中,即

func endGame() {
        let storyboard = UIStoryboard(name: "GameOver", bundle: nil)
        let controller = storyboard.instantiateViewController(withIdentifier: "GameOverView")
        self.present(controller, animated: true, completion: nil)
        vc.modalPresentationStyle = .fullScreen
        self.present(vc, animated: true, completion: nil)
    }

但它什么都不做,Xcode即使我写错了也不会抛出错误。我什至尝试将其从函数中取出并在每次调用 endGame 函数后将其正确放置,但这仍然无效。我确信这是正确的做法,因为我还观看了一个视频,该视频显示有人使用它并且它有效,但由于某种原因它不适合我,即使我通过将这些行放入Button IBAction 函数。我在这里做错了什么?

您必须将 navigation controllerpresentation style 设置为 fullScreen