<分区>
当应用程序移至后台时,如何通过启动图像屏蔽 View 来隐藏我的应用程序中的 secret 信息?我正在使用 Swift 和 iOS 11 创建应用程序。
下面是其他人在旧版 Swift 的 App Delegate 中使用的东西,但我不明白为什么 if on 在当前版本上工作:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.window.bounds];
imageView.tag = 101; // Give some decent tagvalue or keep a reference of imageView in self
// imageView.backgroundColor = [UIColor redColor];
[imageView setImage:[UIImage imageNamed:@"Default.png"]]; // assuming Default.png is your splash image's name
[UIApplication.sharedApplication.keyWindow.subviews.lastObject addSubview:imageView];
}