毛玻璃效果iOS

来源:互联网 发布:淘宝短信催单技巧 编辑:程序博客网 时间:2024/05/21 09:13

一张清楚的图片变的模糊了,也就是所谓的毛玻璃效果,通过查看图层可以发现,它只是在原有的图片上加了一个View,而这个View具有毛玻璃效果,

图层查看如下图所示:

 

最终效果图如下图:

复制代码
1 1     // 创建图片2 2     UIImageView *imgView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];3 3     imgView.image = [UIImage imageNamed:@"1"];4 4     [self.view addSubview:imgView];5 5     //添加模糊效果6 6     UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];7 7     UIVisualEffectView *effectView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];8 8     effectView.frame = [UIScreen mainScreen].bounds;9 9     [imgView addSubview:effectView];
1 0
原创粉丝点击