ios - 退出申请后隐藏用户界面

标签 ios user-interface background passwords

<分区>

问题如下:

我的应用程序可以用密码保护。当用户按下主页按钮时,应用程序退出非事件状态。重新打开后,应用程序显示“输入密码”屏幕。但在它出现之前,初始内容屏幕会显示片刻。此外,如果在按下主页按钮后,用户进入预览模式(双击主页按钮),预览显示内容屏幕,而不是密码屏幕。

所以这里有两个问题:

  1. 如何在应用程序退出之前更改 UI(更改为密码屏幕或某些占位符),以便在预览模式下用户可以看到内容屏幕以外的内容。
  2. 当应用程序再次激活时,如何让应用程序暂时不显示内容屏幕(在密码屏幕之前)。

如有任何帮助,我们将不胜感激。

最佳答案

来自iOS App Programming Guide

What to Do When Moving to the Background

Apps can use their applicationDidEnterBackground: method to prepare for moving to the background state. When moving to the background, all apps should do the following:

  • 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 。

更新 经过更多研究后,事实证明您无法呈现 View Controller - 您只能影响根窗口。我已经测试了这个答案中的解决方案 - Display a view or splash screen before applicationDidEnterBackground (to avoid active view screenshot)它有效 - 因此您可以创建一个图像来显示您的登录屏幕并将其放在 UI 的顶部。

关于ios - 退出申请后隐藏用户界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24257920/

相关文章:

ios - 将 AVAudioRecorder 输入转换为浮点缓冲区

templates - 在哪里可以找到一些好的 UI 模板来设计我的应用程序?

java - 在 Swing 中显示动画 BG

ios - 在后台模式下播放音频

ios - iPhone 6 UIWebView 选择下拉问题

ios - 如何在请求后获取用户对象

iphone - 如何将 SSL 证书导入我的应用程序的钥匙串(keychain)

python - 与 Tkinter 跟踪关联的回调函数有哪些限制?

java - 用于 C++ 应用程序的 Java GUI - 这是一个好的设计吗?

css - 将背景图像放置在 ul/li 元素的边缘之外