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 the scrollView scroll endlessly :
- (void)scrollViewDidScroll:(UIScrollView *)theScrollView {
theScrollView.contentSize = CGSizeMake(45, theScrollView.contentSize.height+45);
}
But how can i create the same effect when the user scrolls upward ? I tried to play with the contentInset but then the contentOfsset doesn't get updated and i end up having weird behaviour.
Do you have any idea how i could achieve that ?
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.
I have developed this kind scroll view. It can scroll infinite.
You can check on github: https://github.com/quangrubify/InfiniteUITableView
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