iOS は画像のガウスぼかし効果を実現します

レンダリングには
画像の説明を追加してください
UIVisualEffectView を使用します

実装コード

- (UIVisualEffectView *)bgEffectView{
    if(!_bgEffectView){
        UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        _bgEffectView = [[UIVisualEffectView alloc] initWithEffect:blur];
    }
    return _bgEffectView;
}

bgEffectView を imageview の上に覆います

- (UIImageView *)bannerView
{
    if (!_bannerView) {
        _bannerView = [[UIImageView alloc] init];
        _bannerView.backgroundColor = [UIColor redColor];
    }
    return _bannerView;
}

- (UIVisualEffectView *)bgEffectView{
    if(!_bgEffectView){
        UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        _bgEffectView = [[UIVisualEffectView alloc] initWithEffect:blur];
    }
    return _bgEffectView;
}


   [self addSubview:self.bannerView];
    [self addSubview:self.bgEffectView];

おすすめ

転載: blog.csdn.net/LIUXIAOXIAOBO/article/details/132161561