ios - 从后台在简历上呈现 ModalViewController,避免下面的内容闪现

标签 ios uiviewcontroller uikit

在我的应用程序中,我在启动时以及从后台恢复以显示加载/摘要屏幕时在 Root View Controller 的顶部显示一个模态视图 Controller 。这在几秒钟后被取消以显示 Root View Controller 。模态通过应用委托(delegate)上的 applicationWillEnterForeground 方法呈现。

一切正常,但是当从后台恢复时,在再次呈现加载模式之前看到下 Root View Controller 闪烁是很常见的。

我正在努力寻找一种明显的方法来进行此演示,以确保它安全地显示而无需首先看到下面的 View 。我是否漏掉了一些非常明显的东西?

最佳答案

documentation说如下:

Prepare to have their picture taken. When the applicationDidEnterBackground: method returns, the system takes a picture of your app’s user interface and uses the resulting image for transition animations. If any views in your interface contain sensitive information, you should hide or modify those views before the applicationDidEnterBackground: method returns.

这意味着您应该修改 applicationDidEnterBackground: 中的 View ,使其按照您希望的方式出现在应用程序进入后台状态时 iOS 自动拍摄的图片中。

还要记住以下几点:

Your app delegate’s applicationDidEnterBackground: method has approximately 5 seconds to finish any tasks and return. In practice, this method should return as quickly as possible. If the method does not return before time runs out, your app is killed and purged from memory. If you still need more time to perform tasks, call the beginBackgroundTaskWithExpirationHandler: method to request background execution time and then start any long-running tasks in a secondary thread. Regardless of whether you start any background tasks, the applicationDidEnterBackground: method must still exit within 5 seconds.

关于ios - 从后台在简历上呈现 ModalViewController,避免下面的内容闪现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11191807/

相关文章:

ios - 通过检查条件防止 UITextField 聚焦?

objective-c - exc 错误访问代码 2

iphone - 你能缓存 UIViewControllers 吗?

uikit - iOS 7 色调颜色 - UINavigationItem 的 backBarButtonItem 在 initWithImage : 时不着色

ios - getDocumentsDirectory Swift5 替代品

ios - 像在 Facebook iOS 7 应用程序中一样获得漂亮的深色 UIToolbar 模糊

ios - UIPresentationController preferredContentSize 更新动画

iphone - 无法在 TableView Swift 上显示任何内容

ios - 如何在 iOS 中监听通知关闭事件?

objective-c - Objective C 向一个 View Controller 传达另一个已更改的 View Controller