Latest 1.1
Homepage https://github.com/silence0201/BlurryBackground
License MIT
Platforms ios 7.0, requires ARC
Authors

程序进入后台模糊效果

使用说明

安装

手工导入

将项目目录下BlurryBackground目录导入项目中
BlurryView:实现模糊效果的View

Pod安装

pod 'BlurryBackground', '~> 1.0'

使用

  1. AppDelegate中导入头文件

    #import "BlurryView.h"
  2. 定义BlurryView的Tag

    static const NSInteger viewTag = 10001 ;
  3. 在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];
            }
        }
    }
    

效果如下

img

BlurryBackground

BlurryBackground is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "BlurryBackground",
    "version": "1.1",
    "summary": "BlurryBackground.",
    "description": "A Simple way to realize BlurryBackground",
    "homepage": "https://github.com/silence0201/BlurryBackground",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Silence": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/silence0201/BlurryBackground.git",
        "tag": "1.1"
    },
    "source_files": [
        "BlurryBackground",
        "BlurryBackground/*.{h,m}"
    ],
    "public_header_files": "BlurryBackground/*.h",
    "requires_arc": true
}

Pin It on Pinterest

Share This