zoukankan      html  css  js  c++  java
  • 实现毛玻璃模糊效果/DRNRealTimeBlur

    四种方法:1.美工出图

         2.coreImage框架,高斯效果

         3.ToolBar,覆盖在view上边

        //1.添加图片
        self.imageView.image = [UIImage imageNamed:@"dog"];
        //2.创建toolbar图层
        UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0,self.imageView.frame.size.width,self.imageView.frame.size.height)];
        //3.设置toolbar模糊背景色调(默认白色)
        toolbar.barStyle = UIBarStyleDefault;
        //4.把图层覆盖到view上
        [self.imageView addSubview:toolbar];

         4.第三方框架DRNRealTimeBlur,继承封装好的view(轻量级,建议使用这种). 或第三方框架:LBBlurredImage

    步骤:

      1.github下载框架

      2.拖入程序

      3.编写代码:

    #import "ViewController.h"
    #import "DRNRealTimeBlurView.h"
    
    @interface ViewController ()
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        //1.随便创建一个imageView
        UIImage *image = [UIImage imageNamed:@"dog"];
        UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
        
        //2.创建毛玻璃View
        DRNRealTimeBlurView *blurView = [[DRNRealTimeBlurView alloc]initWithFrame:imageView.frame];
        
        
        //3.覆盖在imageview上.
        [self.view addSubview: imageView];
        [self.view addSubview:blurView];
    }

      4.实现毛玻璃效果前后:

      

      

    bug:如果在stroyBoard中出现毛玻璃图层无故遮挡其他图层问题,可先将毛玻璃图层调至最底层,在调回正确位置.即可修复.

      

  • 相关阅读:
    Python即时网络爬虫项目启动说明
    Spring Cloud Consul入门
    Selenium用法示例
    云中漫步,做个公众号方便生活、取悦自己
    PhantomJS用法示例
    Python3环境安装PySpider爬虫框架过程
    Python3环境安装Scrapy爬虫框架过程及常见错误
    爬虫扒下 bilibili 视频信息
    Sql优化(一) Merge Join vs. Hash Join vs. Nested Loop
    email.py
  • 原文地址:https://www.cnblogs.com/jiayongqiang/p/5660122.html
Copyright © 2011-2022 走看看