在同一个UITableViewCell中模糊不同的UIImages

时间:2016-05-06 14:16:13

标签: ios uitableview uiimage uitapgesturerecognizer

所以在我的自定义UITableViewCell中,我有4种不同的UIImageView&对于每个UILongTapGestureRecognizer Table View Cells before adding images

添加图片后,表格看起来像这样: Table View Cells after adding images

我需要能够在长按手势识别器后删除图像,当所选图像模糊并显示删除按钮时。

我添加了长按手势识别器方法,虽然我明白我需要对所选图像应用模糊而不是UIImageView本身,我似乎无法获得如何将拾取图像的参考传递给单元格这样我就可以将模糊滤镜应用到图像中。 代理人在这种情况下是否合法使用?

1 个答案:

答案 0 :(得分:0)

为了应用您提到的模糊效果,您需要图像本身。 你可以尝试这样的事情:)

UIImage *image = [yourImageView image];
UIImage *blurredImage = [UIImageEffects imageByApplyingBlurToImage:image withRadius:30 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil];
yourImageView.image = blurredImage;

你可以从这里获取UIImageEffects苹果文件:) https://developer.apple.com/library/ios/samplecode/UIImageEffects/Listings/UIImageEffects_main_m.html

希望有所帮助:)

相关问题