Restore view state without animating segue

2019-07-18 16:24发布

问题:

I have added state restoration to my app, and it seems to work fine, however I'm not happy with the way that it functions.

Basically, the app is a Disney wait time tracker, so it has a selection of the four parks when you first open the app. Tapping on one of these parks segues (with the slide up animation) to the main section of the app. The problem is - When the app is reopened and the view restores after a few seconds, the slide up segue is performed (which is quite distracting).

Anyone have any idea why that is happening?

回答1:

It might be down to how you are triggering your view and what time of segue you are choosing.

Otherwise you can specify whether its animated in your segue method:

ObjectiveC

[self.navigationController pushViewController:aYourViewController animated:NO]

or in Swift:

self.navigationController?.pushViewController(yourController, animated: false)