我正在将模糊效果应用到我的单元格backgroundView
,如下所示:
// Setup imageView
UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageWithData:imageData]];
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.clipsToBounds = YES;
// create effect
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
// add effect to an effect view
UIVisualEffectView *effectView = [[UIVisualEffectView alloc]initWithEffect:blur];
effectView.frame = self.view.frame;
// add the effect view to the image view
[imageView addSubview:effectView];
cell.backgroundView = imageView;
问题在于,这适用的模糊效果太强,你几乎看不到图像:
有没有办法应用更微妙的模糊效果?我尝试了UIBlurEffectStyleExtraLight
和UIBlurEffectStyleDark
,但这些只是改变了亮度,而不是模糊效果的强度。