从多任务返回时防止应用的快照视图

| 问题是这样-我的应用程序允许您通过密码保护自己。我使用的界面就像保护手机的密码一样。一直运行良好,直到出现多任务处理。 密码保护仍然有效,但是存在一个问题。苹果做了一些特殊的事情,使它看起来像我们的应用从后台返回时加载速度更快。操作系统会在用户离开应用程序之前对我们的屏幕进行拍照,并在其余应用程序仍在加载时显示。 造成的问题是,尝试进入我的应用的人会在启用密码保护之前看到屏幕的图像。可以,虽然不多,但是我认为我的用户不会喜欢人们甚至可以瞥见他们的数据。 如何停止显示快照图像?     
已邀请:
        我解决了解决方法如下:
- (void)applicationDidEnterBackground:(UIApplication *)application{
    if (appHasPasscodeOn){
        UIImageView *splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
        splashView.image = [UIImage imageNamed:@\"Default.png\"];
        [window addSubview:splashView];
        [splashView release];
    }
}
Default.png是我的应用程序的屏幕截图,屏幕空白(对我来说,它只是一个空白的列表视图)。上面的代码在应用程序进入后台之前将其置于我的真实视图前面。因此,当您返回到该应用程序时,将看到的全部内容。瞧     
        标记的答案对我来说是完美的,除了当应用再次激活时,splashView仍会显示在屏幕上。我只是将其设置为属性,然后将[splashView removeFromSuperview]添加到我的applicationWillEnterForeground中进行修复。万一其他人得到类似的行为。     
        这是Swift 3.0中的上述解决方案:
lazy var splashImageView: UIImageView = {
    let splashImageView = UIImageView(frame: UIScreen.main.bounds)
    splashImageView.image = UIImage(named: \"splash-view\")
    return splashImageView
}()

func applicationDidEnterBackground(_ application: UIApplication) {
    window?.addSubview(splashImageView)
}

func applicationWillEnterForeground(_ application: UIApplication) {
   splashImageView.removeFromSuperview()
}
    

要回复问题请先登录注册