How to reset/restart viewcontroller in Swift?

后端 未结 3 1117
忘了有多久
忘了有多久 2021-01-05 00:50

I want to have a button on my navigation bar \"Reset\" and I would like this to be connected to an IBAction to sort of \"restart\" the controller.

I ha

3条回答
  •  日久生厌
    2021-01-05 01:00

    You can change rootViewController of your application:

    UIApplication.shared.keyWindow?.rootViewController = UIViewController()

提交回复
热议问题