• 实现毛玻璃效果


    #import "ViewController.h"
    
    @interface ViewController ()
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // 1.1 创建UIImageView对象
        UIImageView *imageView = [[UIImageView alloc] init];
        // 1.2 设置imageView的frame
        imageView.frame = self.view.bounds;
        // 1.3 设置图片
        imageView.image = [UIImage imageNamed:@"1"];
        // 1.4 设置图片的内容模式
        imageView.contentMode = UIViewContentModeScaleAspectFill;
    
        // 1.5 设置毛玻璃
        UIToolbar *toolBar = [[UIToolbar alloc] init];
        toolBar.frame = imageView.bounds;
        // 1.6 设置工具栏的样式
        toolBar.barStyle = UIBarStyleBlack;
        // 1.7 设置透明度
        toolBar.alpha = 0.98;
    
        [imageView addSubview:toolBar];
    
    
        // 2.0 加入控制器的view中
        [self.view addSubview:imageView];
    }
    
    @end
  • 相关阅读:
    L7-5 搞笑的表情包
    L7-6 神奇的验证码
    Fabric中的ACLs相关
    first-network
    关于MSP
    关于数字证书
    Linux命令学习笔记
    shell学习笔记
    区块链
    log的不同级别
  • 原文地址:https://www.cnblogs.com/521it/p/5146385.html
Copyright © 2020-2023  润新知