// 创建显示图片
UIImageView *imageView = [[UIImageView alloc] init];
/** 毛玻璃特效类型
- UIBlurEffectStyleExtraLight,
- UIBlurEffectStyleLight,
- UIBlurEffectStyleDark
*/
UIBlurEffect *blurEffect = [UIBlurEffecteffectWithStyle:UIBlurEffectStyleLight];
// 毛玻璃视图
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
//添加到要有毛玻璃特效的控件中
effectView.frame = imageView.bounds;
[imageView addSubview:effectView];
//设置模糊透明度
effectView.alpha = 0.5f;
网友评论