zoukankan      html  css  js  c++  java
  • iOS简单实现毛玻璃效果

    iOS8之后有一个类 UIVisualEffectView

    // 毛玻璃
        UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
        img.userInteractionEnabled = YES;
        img.image = [UIImage imageNamed:@"effect"];
            [self.view addSubview:img];
    //    UIBlurEffectStyleExtraLight,
    //    UIBlurEffectStyleLight,
    //    UIBlurEffectStyleDark
        UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        UIVisualEffectView *effectview = [[UIVisualEffectView alloc] initWithEffect:blur];
        effectview.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
        effectview.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click)];
        [effectview addGestureRecognizer:tap];
        effectview.alpha = 1.0; // 根据需要设置渲染的程度
        [self.view addSubview:effectview];
  • 相关阅读:
    限制泛型可用类型
    泛型的常规用法(声明两个类型)
    一个类似于金字塔的图形
    Fibonacci数
    快来秒杀我
    奇偶数分离
    Background
    Financial Management
    HangOver
    Binary String Matching
  • 原文地址:https://www.cnblogs.com/xs514521/p/5644043.html
Copyright © 2011-2022 走看看