效果如下图
Paste_Image.png代码如下
- (void)creatVisulBg {
UIImageView *bgImg = [[UIImageView alloc] initWithFrame:self.bounds];
bgImg.image = [UIImage imageNamed:@"bg.jpeg"];
bgImg.contentMode = UIViewContentModeScaleToFill;
bgImg.userInteractionEnabled = YES;
[self addSubview:bgImg];
//添加毛玻璃效果
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
effectView.frame = CGRectMake(0, 0, bgImg.frame.size.width, bgImg.frame.size.height);
[bgImg addSubview:effectView];
}
网友评论