zoukankan      html  css  js  c++  java
  • iOS 8 模糊视图(毛玻璃效果)的简单实现UIVisualEffectView

    在须要模糊的UIView上。加入一个UIVisualEffectView对象就可以。

    效果例如以下图:




    代码例如以下:


        UIImageView *imageview = [[UIImageViewalloc] init];

        imageview.frame =CGRectMake(10,100, 300, 300);

        imageview.image = [UIImageimageNamed:@"2"];

        imageview.contentMode =UIViewContentModeScaleAspectFit;

        imageview.userInteractionEnabled =YES;

        [self.viewaddSubview:imageview];

        

        UIBlurEffect *blur = [UIBlurEffecteffectWithStyle:UIBlurEffectStyleLight];

        UIVisualEffectView *effectview = [[UIVisualEffectViewalloc] initWithEffect:blur];

        effectview.frame =CGRectMake(0,0, imageview.size.width/2,300);

        

        [imageviewaddSubview:effectview];

        

        

        UIButton *btn = [UIButtonbuttonWithType:UIButtonTypeSystem];

        btn.frame =CGRectMake(10,50, 100, 40);

        [btn setTitle:@"btn"forState:UIControlStateNormal];

        [effectview.contentViewaddSubview:btn];



    iOS开发交流群361513739

  • 相关阅读:
    得到cxgrid筛选后的记录数
    服务器之ipmitool
    CentOS6.8部署SVN
    NGINX快速部署
    Nginx模块系列之auth_basic模块
    持续集成、持续交付、持续部署
    CentOS6.X 升级内核至 3.10
    Dmidecode
    新建虚拟机
    Linux之(tomcat)服务之服务调优
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/5217586.html
Copyright © 2011-2022 走看看