Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "AppDelegate.h"
- @interface AppDelegate ()
- @property (nonatomic, strong) UIVisualEffectView *effectView;
- @end
- @implementation AppDelegate
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- // Override point for customization after application launch.
- UIVisualEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
- self.effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
- self.effectView.frame = self.window.bounds;
- self.effectView.alpha = 0;
- return YES;
- }
- - (void)applicationWillResignActive:(UIApplication *)application {
- [self.window addSubview:self.effectView];
- [UIView animateWithDuration:0.5 animations:^{
- self.effectView.alpha = 1;
- } completion:^(BOOL finished) {
- }];
- }
- - (void)applicationDidBecomeActive:(UIApplication *)application {
- [UIView animateWithDuration:0.3 animations:^{
- self.effectView.alpha = 0;
- } completion:^(BOOL finished) {
- [self.effectView removeFromSuperview];
- }];
- }
- - (void)applicationWillTerminate:(UIApplication *)application {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- }
- @end
Add Comment
Please, Sign In to add comment