问题描述
我想创建一个无限滚动视图(如老虎机),但没有分页.当用户向下滚动时,很容易我只需要增加 contentSize 和 scrollView 无休止地滚动:
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);
}
但是当用户向上滚动时,我如何创建相同的效果?我尝试使用 contentInset 但随后 contentOfsset 没有更新,我最终出现了奇怪的行为.
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 ?
推荐答案
我需要同样的,所以我创建了这个:http://dev.doukasd.com/2011/04/infinite-scrolling-dial-control-for-ios/
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.
这篇关于双向无限 UIScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!