Dismiss more than one view controller simultaneously

后端 未结 9 862
一向
一向 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:32

    I had some animation issues when trying the accepted answer in my application. The previously presented views would flash or try to animate on the screen. This was my solution:

         if let first = presentingViewController,
            let second = first.presentingViewController,
                let third = second.presentingViewController {
                    second.view.isHidden = true
                    first.view.isHidden = true
                        third.dismiss(animated: true)
    
         }
    

提交回复
热议问题