Force uiscrollview to bounce scrolling even with a single item

血红的双手。 提交于 2019-12-12 10:33:28

问题


I have a UIScrollView with varying numbers of items/subviews. When there is more than one item, scrolling bounce works. However, there are times when the scrollview should only have one item, and I would like to provide the feedback to the user that their scrolls are being recognized--thus the bounce effect. However, UIScrollView disables scrolling with just one item.


回答1:


Answer: set alwaysBounceHorizontal or alwaysBounceVertical to true. I answered my own question while writing this up and figured I might as well post it to help others.




回答2:


Additionally, a UIScrollView will not scroll in (width / height) if the contentSize property is not greater than the frame property (in width / height)



来源:https://stackoverflow.com/questions/5021338/force-uiscrollview-to-bounce-scrolling-even-with-a-single-item

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