iOS状态恢复动画bug [英] iOS state restoration animation bug

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

问题描述

我只想在我的某个应用中实现iOS State-Restoration API。
最后让它工作后,我发现我以模态方式呈现的ViewController使用动画恢复,这不是我想要的。我希望我的应用程序只处于我离开它的状态,但没有让用户看到他到那里的热点。

I just wanted to implement the iOS State-Restoration APIs in one of my Apps. After finally getting it to work, I discovered that a ViewController that I present modally gets restored using an animation, which is not what I want. I would expect my app to just be in the state I left it, but not having the user to see hot he got there.

所以我继续下载Apple Sample代码: https://developer.apple.com/library /ios/samplecode/StateRestore/Introduction/Intro.html 并想知道它是否也在那里发生。事实证明它确实如此。

So I went ahead and downloaded Apple Sample Code on that: https://developer.apple.com/library/ios/samplecode/StateRestore/Introduction/Intro.html and wanted to see if it happens there as well. And it turns out that it does.

此外,日志中还有一个警告:

Further there is a warning in the Logs:

Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7b0512b0>.

你能否告诉我,我是否明显苹果样本代码做错了什么,或者它是否是一个bug在iOS?

Can you tell me if I and obviously Apples Sample Code are doing something wrong, or if it's a bug in iOS?

Btw。我在iOS8上测试

Btw. I was testing on iOS8

感谢您的帮助,
Georg

Thanks for any help, Georg

推荐答案

以下解决方案直接来自Apple。

The following solution comes directly from Apple.

在你的app delegate中,你应该实现应用程序:willFinishLaunchingWithOptions:(代替 didFinishLaunching 除此之外)。在您的实现中,可能是在返回 true 之前的最后一行(如果这是Objective-C,则为YES),插入以下行:

In your app delegate, you should be implementing application:willFinishLaunchingWithOptions: (instead of or in addition to didFinishLaunching). In your implementation, probably as the last line just before returning true (or YES if this is Objective-C), insert this line:

self.window?.makeKeyAndVisible()

或者,如果这是Objective-C:

Or, if this is Objective-C:

[self.window makeKeyAndVisible];

事实证明这是始终需要,但文档从未很清楚。

It turns out that this was always needed, but the documentation has never been clear about it.

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

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