高斯模糊
简单的在背景的图片上放一个高斯图层,背景图片和头像数据源一样,就是等比放大。
[_headImgView sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:_IMG(@"DefaultHeader")];
// 高斯背景图
UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(-frame.size.width/2, -frame.size.height/2, frame.size.width*2, frame.size.height*3/2)];
imageView.contentMode = UIViewContentModeScaleAspectFit;
[imageView sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:_IMG(@"ProMineBGImg")];
UIVisualEffectView * visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
visualEffectView.frame = CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height);
[imageView addSubview:visualEffectView];
[self addSubview:imageView];
[self sendSubviewToBack:imageView];
网友评论