Preventing snapshot view of your app when coming back from multi-tasking(从多任务处理回来时阻止您的应用程序的快照视图)
问题描述
问题是这样的 - 我的应用程序可以让您通过密码保护自己.我使用一个界面,就像保护手机的密码一样.这一直很好,直到出现多任务处理.
The problem is this - My app lets you passcode protect itself. I use an interface just like passcode protecting the phone. This has always worked fine, until multi-tasking came along.
密码保护仍然有效,但存在一个问题.Apple 做了一些特别的事情,让我们的应用程序从后台返回时看起来加载速度更快.操作系统在用户离开应用程序之前拍摄我们的屏幕照片,并在应用程序的其余部分仍在加载时显示.
The passcode protection still works, but there is one issue. Apple does something special to make it look like our apps are loading quicker when they come back from the background. The os takes a picture of our screen just before the user leaves the app, and it displays that while the rest of the app is still loading.
这导致的问题是,试图访问我的应用程序的人会在密码保护启动之前看到屏幕图像.当然,这并不多,但我认为我的用户不会喜欢人的想法甚至能够瞥见他们的数据.
The problem this causes is that someone trying to go to my app would see that image of the screen before the passcode protection kicked in. Granted, it's not much, but I don't think my users will like the idea of people being able to get even a little glimpse of their data.
如何停止显示该快照图像?
How to stop that snapshot image from showing?
推荐答案
我解决了这个问题.这是解决方案:
I solved this. Here is the solution:
- (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 是我的应用程序的屏幕截图,带有一个空白屏幕(对我来说它只是一个空白列表视图).上面的代码在应用程序进入后台之前将其置于我的真实视图之前.因此,当您回到应用程序时,您所看到的一切.瞧.
Default.png is a screenshot of my app with a blank screen (for me it's just a blank listview). The code above puts that in front of my real view right before the app goes into the background. So, when you come back to the app that is all you see. Voila.
这篇关于从多任务处理回来时阻止您的应用程序的快照视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从多任务处理回来时阻止您的应用程序的快照视图


- Android viewpager检测滑动超出范围 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01