菜鸟教程小白 发表于 2022-12-11 17:37:45

ios - 如何制作像 3D touch 一样的背景的模糊效果


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

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

<p>这张图片是关于 3D touch peek pop 背景:
<a href="/image/d7Xpv.png" rel="noreferrer noopener nofollow"><img src="/image/d7Xpv.png" alt="enter image description here"/></a> </p>

<p>这是 UIBlurEffectStyleExtraLight 样式的 UIVisualEffectView:
<a href="/image/y7j5O.png" rel="noreferrer noopener nofollow"><img src="/image/y7j5O.png" alt="enter image description here"/></a> </p>

<p>提前谢谢</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>请为customView的backgroundView添加以下代码...</p>

<pre><code> UIBlurEffect *blurEffect = ;// you have a list of options for UIBlurEffectStyle
UIVisualEffectView *blurEffectView = [ 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
;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何制作像 3D touch 一样的背景的模糊效果,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/39653870/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/39653870/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何制作像 3D touch 一样的背景的模糊效果