zoukankan      html  css  js  c++  java
  • UIBlurEffect 毛玻璃特效实现

    iOS 8 后使用 UIBlurEffect 类和 UIVisualEffectView 类添加毛玻璃特效更加便捷,高效。

    //创建ImageView
    IImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"5"]];
        //  创建需要的毛玻璃特效类型
        /**
         *  UIBlurEffectStyleExtraLight,
         *  UIBlurEffectStyleLight,
         *  UIBlurEffectStyleDark
         */
        UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
    
        //添加到要有毛玻璃特效的控件中
        UIVisualEffectView *visual = [[UIVisualEffectView alloc] initWithEffect:blur];
        visual.frame = imageView.bounds;
        [self.view addSubview:imageView];

    效果图:

    原图:

    这里写图片描述

    (1) UIBlurEffectStyleExtraLight

    这里写图片描述

    (2) UIBlurEffectStyleLight

    这里写图片描述

    (3) UIBlurEffectStyleDark

    这里写图片描述

  • 相关阅读:
    注册验证
    翻页加输入框
    php面向对象
    封装数据库
    浅谈BFC和haslayout
    总结JS面向对象
    总结(JS)
    转载6
    总结(5.30)
    总结(5.29)
  • 原文地址:https://www.cnblogs.com/xiaocai-ios/p/7779762.html
Copyright © 2011-2022 走看看