我在我的项目中使用了精彩的StackBlur类,可以正常工作,但我试图创建一个类似于Yahoo Weather App的效果,其中图像根据滚动值模糊。 我已经设法使用scrollViewDidScroll方法实现它,但效果很慢并且很缓慢。
哟解决这个问题的最好方法是什么? 将图像存储到缓存是我能想到的唯一的事情。
谢谢
UPDATE
我简单地创建了两个UIImageView,其中一个带有模糊,然后将alpha设置为零,并使用scrollview中的内容偏移量增加它。
A am using the brilliant StackBlur class with in my project which works fine however I am trying to create a similar effect to the Yahoo Weather App in which the image blurs according to the scroll value. I have managed to achieve it using the scrollViewDidScroll method however the effect is slow and laggy.
What is the best way yo resolve this? Storing the image to the Cache is the only thing I can think of.
Thanks
UPDATE
I simply created two UIImageViews one with the blur and then set the alpha to zero and increased it with the content offset off the scrollview.
最满意答案
每当scrollViewDidScroll调用时都不需要模糊。 相反,您需要带有最终模糊效果的模糊图像视图,并且不要将模糊图像视图放置在模糊图像视图下方。 将模糊imageView的view.alpha从0.0更改为1.0将无需额外成本即可获得此效果。
You don't need to blur every time when scrollViewDidScroll called. Instead, you need a blurred imageView with the final blur effect and none blurred imageView placed below the blurred one. Change view.alpha of blurred imageView from 0.0 to 1.0 will get this effect without extra cost.
更多推荐
发布评论