几行代码搞定图片模糊模式
Posted ios攻城狮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了几行代码搞定图片模糊模式相关的知识,希望对你有一定的参考价值。
- (void)viewDidLoad {
[super viewDidLoad];
// 做图片
UIImageView *myImgView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
myImgView.image = [UIImage imageNamed:@"A2D368D0CE416A120C9A4411C1B721CA.png"];
[self.view addSubview:myImgView];
//添加模糊效果
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
//三种效果 UIBlurEffectStyleDark UIBlurEffectStyleExtraLight UIBlurEffectStyleLight
UIVisualEffectView *effectView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
effectView.frame = [UIScreen mainScreen].bounds;
[myImgView addSubview:effectView];
// Do any additional setup after loading the view, typically from a nib.
}
以上是关于几行代码搞定图片模糊模式的主要内容,如果未能解决你的问题,请参考以下文章