zoukankan      html  css  js  c++  java
  • 第三十七篇、毛玻璃效果

     我们在做界面布局的时候,毛玻璃效果也时常的应用在我们的应用当中,利用播放视频的时候,视频没有加载出来,需要放一张毛玻璃图片来显示

    // 定义毛玻璃效果
        UIBlurEffect * blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
        UIVisualEffectView * effe = [[UIVisualEffectView alloc]initWithEffect:blur];
        effe.frame = CGRectMake(50, 90, self.view.frame.size.width - 100, 400);
        // 把要添加的视图加到毛玻璃上
        UIButton * but = [[UIButton alloc]initWithFrame:CGRectMake(50, 50, 100, 100)];
        but.backgroundColor = [UIColor redColor];
        [effe addSubview:but];
        [self.view addSubview:effe];
    //他的效果是枚举,有三种
    UIBlurEffectStyleExtraLight
    UIBlurEffectStyleLight
    UIBlurEffectStyleDark
    
    // 定义需要毛玻璃化的图片
        UIImageView * image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"2.png"]];
        image.frame = CGRectMake(100, 100, 100, 100);
    
    图片模糊:
        // 定义毛玻璃效果
        UIBlurEffect * blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
        UIVisualEffectView * effe = [[UIVisualEffectView alloc]initWithEffect:blur];
        effe.frame = CGRectMake(50, 90, self.view.frame.size.width - 100, 400);
        // 添加毛玻璃
        [image addSubview:effe];
        [self.view addSubview:image];
  • 相关阅读:
    1003 我要通过! (20 分)
    安装ANSYS19.0的正确方法(附下载)
    多项式最小二乘法拟合
    递归循环嵌套排列组合
    对二维数组使用指针进行操作的探索(C语言)
    统计C语言关键字出现次数
    三次样条插值matlab实现
    绩点换算小程序
    B1020 月饼(25 分)
    问题 B: 分组统计
  • 原文地址:https://www.cnblogs.com/HJQ2016/p/5903115.html
Copyright © 2011-2022 走看看