view添加毛玻璃效果两种方法

时间:2022-12-13 06:05:19
第一种方法:
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
effectView.alpha = 0.9;
effectView.frame = CGRectMake(, , bgImageView.frame.size.width, bgImageView.frame.size.height);
[bgImageView addSubview:effectView];
 
第二种方法:
UIToolbar *toolbar = [[UIToolbaralloc] initWithFrame:CGRectMake(, , SCREEN_WIDTH, SCREEN_HEIGHT)];
toolbar.barStyle = UIBarStyleDefault;
[_backImg addSubview:toolbar];