Created
August 17, 2017 15:07
-
-
Save mehmetf/f963c74770925045be5ee01ce186012a to your computer and use it in GitHub Desktop.
secure window with color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)applicationWillResignActive:(UIApplication *)application { | |
UIView *__autoreleasing colorView = | |
[[UIView alloc] initWithFrame:self.window.frame]; | |
// Can be any integer you’re not using as a tag. | |
colorView.tag = 9999; | |
// Here we used white as the subview color. | |
colorView.backgroundColor = [UIColor whiteColor]; | |
[self.window addSubview:colorView]; | |
[self.window bringSubviewToFront:colorView]; | |
} | |
— (void)applicationDidBecomeActive:(UIApplication *)application { | |
UIView *colorView = [self.window viewWithTag:9999]; | |
[colorView removeFromSuperview]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment