简体   繁体   English

UIScrollView,背景设置为模糊图像

[英]UIScrollView with a background set to the blurred image

I have a UIScrollView that shows certain images based on an index. 我有一个UIScrollView ,它基于索引显示某些图像。 When an image loads, I want to set the background of the UIScrollView to the blurred version of that image. 加载图像时,我想将UIScrollView的背景设置为该图像的模糊版本。 Right now I have a container view that houses the scrollView , and I've been trying to add a blurred subView to the container but it's not working out. 现在,我有一个容纳scrollView的容器视图,并且我一直在尝试向容器中添加一个模糊的subView ,但是它没有成功。 If I just add the subview it gets rendered over the scrollView which id obviously no good, and If I add the subView and send it to back then I don't see any blurred effect at all. 如果我只是添加子视图,那么它会通过id显然不好的scrollView呈现,并且如果我添加subView并将其发送回去,那么我根本看不到任何模糊的效果。

Is this the right approach or is there a better way to achieve the effect I'm going for? 这是正确的方法还是有更好的方法来达到我想要的效果?

As you said "and If I add the subview and send it to back then I don't see any blurred effect at all." 如您所说:“如果我添加子视图并将其发送回去,那么我根本看不到任何模糊效果。”

To sort it out, You may try changing the background color of Scrollview to clearColor. 为了解决这个问题,您可以尝试将Scrollview的背景色更改为clearColor。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM