Dismiss more than one view controller simultaneously

后端 未结 9 851
一向
一向 2020-12-04 17:50

I\'m making a game using SpriteKit. I have 3 viewControllers: selecting level vc, game vc, and win vc. After the game is over, I want to show the win vc, then if I press OK

9条回答
  •  春和景丽
    2020-12-04 18:38

    Adding on to Phlippie Bosman's answer, when calling

    self.presentingViewController?.presentingViewController?.dismiss(animated: true, completion: nil)
    

    if you don't want to see (what would be the presentingViewController) you can do something like

    self.presentingViewController?.view.addSubview(self.view)
    

    This seems a bit hacky, but so far it's been the only way I've been able to make it seem like two view controllers are dismissing in unison.

提交回复
热议问题