Infinite UIScrollView in both direction

后端 未结 3 724
旧时难觅i
旧时难觅i 2021-01-03 15:54

I would like to create an infinite scrollView (like a slot machine), but without paging. When the user scrolls down, it\'s easy i just have to increase the contentSize and t

相关标签:
3条回答
  • 2021-01-03 16:19

    I think you should give us more details about the issue. What content do you want the user to see when he is scrolling upwards? You increase the contentSize in scrollViewDidScroll method, but you are not checking the contentOffset, so the contentWill be bigger whenever the user scrolls the scrollView (either way, even horizontal if allowed). Since the contentOffset is already at 0, the user cant scroll upwards because there is nothing that the scroll view can show.

    I dont know the content of your scrollView, but I have implemented infinite scrolling horizontally. For details, see: https://stackoverflow.com/a/12856174/936957

    PS: Do not use "magic numbers", this is a better alternative:

     theScrollView.contentSize = CGSizeMake(theScrollView.contentSize.x, theScrollView.contentSize.height+45); 
    //Or theScrollView.frame.size.width alternatively
    
    0 讨论(0)
  • 2021-01-03 16:20

    I have developed this kind scroll view. It can scroll infinite. You can check on github: https://github.com/quangrubify/InfiniteUITableView

    0 讨论(0)
  • 2021-01-03 16:25

    I needed the same, so I created this: http://dev.doukasd.com/2011/04/infinite-scrolling-dial-control-for-ios/

    Have a look at the video, I believe it's what you're looking for. Source code is included.

    0 讨论(0)
提交回复
热议问题