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

    只要努力,结果就会像大白兔奶糖一样甜。
  • 相关阅读:
    shell 命令
    unzip解压失败 添加tar 解压
    tomcat
    Linux常用命令
    压缩归档与解压
    Linux的任务计划管理
    A01. openstack架构实战-openstack基本环境准备
    ubuntu16.04 server版破解密码
    Ubuntu Server 18.04 网络设置不生效的解决
    带宽单位 Mbps 及换算方式
  • 原文地址:https://www.cnblogs.com/mmhc/p/4528873.html
Copyright © 2011-2022 走看看