无需动画转场即可恢复视图状态 [英] Restore view state without animating segue

查看:27
本文介绍了无需动画转场即可恢复视图状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将状态恢复添加到我的应用中,它似乎运行良好,但我对它的运行方式并不满意.

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?

推荐答案

这可能取决于您如何触发视图以及您选择的转场时间.

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

否则你可以在你的 segue 方法中指定它是否动画:

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

目标C

[self.navigationController pushViewController:aYourViewController animated:NO]

在 Swift 中:

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

这篇关于无需动画转场即可恢复视图状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆