【发布时间】:2018-03-27 19:05:08
【问题描述】:
如何通过在应用移至后台时使用启动图像阻止视图来隐藏应用内的机密信息?我正在使用 Swift 和 iOS 11 创建应用程序。
以下是其他人在旧版本 Swift 上的 App Delegate 中使用的东西,但我不明白为什么 if 可以在当前版本上工作:
- (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];
}
【问题讨论】: