我正在开发一个 iOS 项目,并且想要保护该应用程序的安全。我已经能够创建和密码 View Controller ,它工作正常,但我想在应用程序即将进入后台或进入前台之前显示密码 View 。我知道 Appdelegate 提供了有用的方法,但我如何实现它来显示密码 View Controller 。我尝试实现 rootviewcontroller 以在 Appdelegate 中显示密码 View Controller ,但它不起作用并给出调试器消息“尝试显示不在层次结构中的 View Controller ”。
最佳答案
将此行添加到 viewDidLoad() 函数中:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "showPasscodeView:", name: UIApplicationWillEnterForegroundNotification, object: nil)
然后在 showPasscodeView() 函数中显示密码 View 。
关于ios - 如何在 iOS 应用程序中显示密码 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41329773/