实现毛玻璃效果

#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
原文地址:https://www.cnblogs.com/521it/p/5146385.html