如何像3D触摸一样制作模糊效果

时间:2016-09-23 06:21:22

标签: ios blur uivisualeffectview

我需要对自定义视图进行模糊效果,并且看起来与3D touch一样。

PS:我没有发现UIVisualEffectView支持这种效果。我们的系统只支持三个UIBlurEffectStyle,这与3D touch不同。

这张图片是关于3D touch peek pop背景: enter image description here

这是UIBlurEffectStyleExtraLight样式的UIVisualEffectView: enter image description here

提前THX

1 个答案:

答案 0 :(得分:0)

请为customView的backgroundView添加以下代码...

 UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];// you have a list of options for UIBlurEffectStyle
 UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
 blurEffectView.frame = self.view.bounds; // Make your own frame
 blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; // Skip this line if you are using new style of coding
 [bgImageV addSubview:blurEffectView];