OGeek|极客世界-中国程序员成长平台

标题: ios - 如何制作像 3D touch 一样的背景的模糊效果 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 17:37
标题: ios - 如何制作像 3D touch 一样的背景的模糊效果

我需要为我的自定义 View 制作模糊效果,并且看起来与 3D 触摸相同。

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

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

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

提前谢谢



Best Answer-推荐答案


请为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];

关于ios - 如何制作像 3D touch 一样的背景的模糊效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39653870/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4