Instead of push segue how to replace view controller (or remove from navigation stack)?

前端 未结 14 899
眼角桃花
眼角桃花 2020-11-28 01:46

I have a small iPhone app, which uses a navigation controller to display 3 views (here fullscreen):

\"Xcode

14条回答
  •  日久生厌
    2020-11-28 02:46

    This worked for me in Swift 3:

    class ReplaceSegue: UIStoryboardSegue {
        override func perform() {
            if let navVC = source.navigationController {
                navVC.pushViewController(destination, animated: true)
            } else {
                super.perform()
            }
        }
    }
    

提交回复
热议问题