CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Jan 2017 |
Maintained by Silence0201.
程序进入后台模糊效果
将项目目录下BlurryBackground目录导入项目中
BlurryView:实现模糊效果的View
pod 'BlurryBackground', '~> 1.0'
在AppDelegate中导入头文件
#import "BlurryView.h"
定义BlurryView的Tag
static const NSInteger viewTag = 10001 ;
在App的生命周期中控制:
当程序进入后台添加模糊:
- (void)applicationDidEnterBackground:(UIApplication *)application{
BlurryView *blurView = [[BlurryView alloc]initWithFrame:self.window.frame] ;
blurView.tag = viewTag ;
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
if (window.windowLevel == UIWindowLevelNormal) {
[window addSubview:blurView];
}
}
}
当程序进入前台删除模糊:
- (void)applicationWillEnterForeground:(UIApplication *)application{
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
if (window.windowLevel == UIWindowLevelNormal) {
UIView *view = [window viewWithTag:viewTag];
[view removeFromSuperview];
}
}
}
BlurryBackground is available under the MIT license. See the LICENSE file for more info.