毛玻璃CHBlurEffect

1、将需要加入毛玻璃的UI控件传入接口即可

  • 1.1 .h文件

    //
    // 文 件 名:CHBlurEffect.h
    // 
    // 版权所有:Copyright © 2018年 leLight. All rights reserved.
    // 创 建 者:leLight 
    // 创建日期:2018/7/25.
    // 文档说明:
    // 修 改 人:
    // 修改日期:
    // 
    
    #import <Foundation/Foundation.h>
    
    @interface CHBlurEffect : NSObject
    
    /************ 设置毛玻璃效果,传入要加毛玻璃的视图,即可完成添加 ***********************/
    + (void)blurEffect:(UIView *)view;
    
    @end
  • 1.2 .m文件

    //
    // 文 件 名:CHBlurEffect.m
    // 
    // 版权所有:Copyright © 2018年 leLight. All rights reserved.
    // 创 建 者:leLight 
    // 创建日期:2018/7/25.
    // 文档说明:
    // 修 改 人:
    // 修改日期:
    // 
    
    #import "CHBlurEffect.h"
    
    @implementation CHBlurEffect
    
    /************ 设置毛玻璃效果,传入要加毛玻璃的视图,即可完成添加 ***********************/
    + (void)blurEffect:(UIView *)view {
    
        UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        UIVisualEffectView *effectVIew = [[UIVisualEffectView alloc] initWithEffect:effect];
        effectVIew.frame = view.bounds;
        [view addSubview:effectVIew];
    }
    
    @end

猜你喜欢

转载自www.cnblogs.com/CH520/p/9593909.html
今日推荐