iOS开发之高斯模糊图片虚化/背景填充效果

高斯模糊图片虚化

生成一个UIVisualEffectView图层,覆盖在你需要做高斯模糊的位置上方

    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
    // 记得设置Frame
    effectView.frame = CGRectMake(0, 0, 100, 100);

背景填充效果

UIView生成一个有test图片铺满的样式

test 的图案为:在这里插入图片描述UIView的效果等大铺满的为:在这里插入图片描述

    UIImage *image = [UIImage imageNamed:@"test"];
    self.view.backgroundColor = [UIColor colorWithPatternImage:image];

猜你喜欢

转载自blog.csdn.net/weixin_46926959/article/details/129325857