UIScrollView (paging mode) bounces only when there two or more pages?

狂风中的少年 提交于 2019-12-04 19:03:51

you can use the property :

scroll.alwaysBounceHorizontal= YES;

or

 scroll.alwaysBounceVertical = YES;

or both

Don't add 1px, it will create problems to you if you add touchable elements in the UIView inside your scrollview.

Never forget to define again your contentSize after redefine the frame of your scroll. even the contentSize keep the same value.

Good luck

answer myself.

If you want UIScrollView to be able to bounce, you should set its contentSize bigger than its frame size.

Even 1px bigger is enough

for my own code, if I set scroll.contentSize = CGSizeMake(768 * 1 + 1, 1004); it will work and bounce.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!