View 添加毛玻璃效果

第一种方法:

UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect]; effectView.alpha = 0.9;
effectView.frame = CGRectMake(0, 0, bgImageView.frame.size.width, bgImageView.frame.size.height);
[bgImageView addSubview:effectView];

 

第二种方法:

UIToolbar *toolbar = [[UIToolbaralloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
toolbar.barStyle = UIBarStyleDefault;
[_backImg addSubview:toolbar];

 

posted @ 2021-03-12 08:36  循序渐进A  阅读(87)  评论(0)    收藏  举报