How to Remove a Previous ViewController

前端 未结 5 1806
予麋鹿
予麋鹿 2021-02-02 16:48

I am a student and pretty new to programming. I am trying to learn Objective-C/Swift in my spare time. I made a game using spriteKit with swift that has multiple menus/scenes. <

5条回答
  •  时光说笑
    2021-02-02 17:40

    Swift 3

    This will remove the current view controller from the memor

    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        guard let viewControllers = navigationController?.viewControllers,
        let index = viewControllers.index(of: self) else { return }
        navigationController?.viewControllers.remove(at: index)
    }
    

提交回复
热议问题