金融app退后台高斯模糊效果

@property (nonatomic,strong)UIVisualEffectView *visualEffectView;//毛玻璃效果
- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    _visualEffectView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
    _visualEffectView.alpha = 0.97f;
    _visualEffectView.frame =self.window.bounds;
    [[UIApplication sharedApplication].keyWindow addSubview:_visualEffectView];
     NSLog(@"取消活跃");
}



- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    NSLog(@"进入前台");
    [_visualEffectView removeFromSuperview];
    
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    NSLog(@"变得活跃");
    [_visualEffectView removeFromSuperview];
}

你可能感兴趣的:(金融app退后台高斯模糊效果)