简体   繁体   English

ios swift - 图像滚动视图不滚动

[英]ios swift - scroll view over image doesn't scroll

I want to have a background image that does not move and have a scrollview over it that allows users to scroll through content while the back image remaining static. 我希望有一个不移动的背景图像,并在其上有一个滚动视图,允许用户滚动浏览内容,而后面的图像保持静态。

I have tried adding an image to my view and then after a scroll view over it but I'm unable to scroll. 我已经尝试将图像添加到我的视图中,然后在滚动视图之后但我无法滚动。

I'm trying to achieve an effect similar to this: 我试图达到类似这样的效果:

在此输入图像描述

Am I on the right path to achieving this? 我是否正确地实现了这一目标?

You have to set contentSize for UIScrollView. 您必须为UIScrollView设置contentSize。 ContentSize has to greater than frame size. ContentSize必须大于帧大小。

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

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