几行代码实现图片的模糊效果

//    创建一个imageView

    UIImageView * backImageView = [[UIImageView alloc]initWithFrame:self.view.bounds];

    backImageView.image = [UIImage imageNamed:@"[email protected]"];

    [self.view addSubview:backImageView];

    

//添加模糊效果

    UIBlurEffect * blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];

    UIVisualEffectView * effectView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];

    effectView.frame = CGRectMake(0, 64, self.view.frame.size.width, 300);

    [backImageView addSubview:effectView];

 

你可能感兴趣的:(几行代码实现图片的模糊效果)