1.
@interface AppDelegate()
///模糊处理
@property(nonatomic,strong)UIVisualEffectView *visualEffectView;
@end
2.
/**
* 应用程序即将由活动状态切换到非活动状态时
*/
-(void)applicationWillResignActive:(UIApplication *)application {
[self.window addSubview:self.visualEffectView];
}
3.
/**
* 应用程序已被激活后
*/
-(void)applicationDidBecomeActive:(UIApplication *)application {
[self.visualEffectView removeFromSuperview];
}
4.- (UIVisualEffectView *)visualEffectView {
if(_visualEffectView) {return_visualEffectView; } UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; visualEffectView.frame=self.window.frame; _visualEffectView = visualEffectView;return_visualEffectView;
}
网友评论