设置毛玻璃效果
// 1.创建UIImageView对象 UIImageView *imageView = [[UIImageView alloc] init]; // 2. 设置尺寸 // imageView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); imageView.frame = self.view.bounds; // 3. 设置背景颜色 imageView.backgroundColor = [UIColor redColor]; // 4. 设置背景图片 imageView.image = [UIImage imageNamed:@"1"]; // 5.设置图片的内容模式 imageView.contentMode = UIViewContentModeScaleAspectFill; // 6.加毛玻璃 // 6.1 创建UIToolBar对象 UIToolbar *toolBar = [[UIToolbar alloc] init]; // 6.2 设置toolBar的frame toolBar.frame = imageView.bounds; // 6.3 设置毛玻璃的样式 toolBar.barStyle = UIBarStyleBlack; toolBar.alpha = 0.98; // 6.4 加到imageView中 [imageView addSubview:toolBar]; // 加到控制器的view中 [self.view addSubview:imageView];