zoukankan      html  css  js  c++  java
  • FXBlurView用法

    FXBlurView是UIView的子类,它实现毛玻璃效果的原理其实就是覆盖上一层FXBlurView的实例对象。

     1 - (void)viewDidLoad {
     2     [super viewDidLoad];
     3 
     4     UIImageView * imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
     5     imageView.image = [UIImage imageNamed:@"Default-Port-hd47"];
     6     [self.view addSubview:imageView];
     7 
     8     FXBlurView * aview = [[FXBlurView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
     9     aview.tintColor = [UIColor whiteColor];  //前景颜色
    10     aview.blurRadius = 20.0;                 //模糊半径
    11     aview.dynamic = YES;                     //动态改变模糊效果    
    12     [self.view addSubview:aview];
    13 
    14     FXBlurView * bview = [[FXBlurView alloc] initWithFrame:CGRectMake(0, 120, 100, 100)];
    15     bview.tintColor = [UIColor whiteColor];  //前景颜色
    16     bview.blurEnabled = YES;                //是否允许模糊,默认YES
    17     bview.blurRadius = 10.0;               //模糊半径
    18     bview.dynamic = YES;                   //动态改变模糊效果
    19     bview.iterations = 2;                  //迭代次数:
    20     bview.updateInterval = 2.0;            //更新时间(不确定具体功能)
    21 
    22     /*
    23      blurRadius = 1.0 && dynamic = 100 的效果和 blurRadius = 10.0 && dynamic = 1的效果大致相同
    24      */    
    25 
    26     [self.view addSubview:bview];
    27 
    28     FXBlurView * cview = [[FXBlurView alloc] initWithFrame:CGRectMake(150, 0, 200, 200)];
    29     cview.blurRadius = 20.0;
    30     cview.tintColor = [UIColor whiteColor];
    31     [self.view addSubview:cview];
    32 }

    demo下载:https://github.com/nicklockwood/FXBlurView

    只要努力,结果就会像大白兔奶糖一样甜。
  • 相关阅读:
    c++ 函数
    c++ 数字
    c++语句(判断)
    十九、夜间模式的开启与关闭,父模板的制作
    二十、开始Flask项目
    十八、完成登录与注册页面的前端
    十七、JavaScript 基础,登录前端验证
    CSS实例:图片导航块
    十五、导航,头部,CSS基础
    十四、web基础,用html元素制作web页面
  • 原文地址:https://www.cnblogs.com/mmhc/p/4528873.html
Copyright © 2011-2022 走看看