是否有滚动视图滚动时运行函数的方法/可能性?
我发现滚动开始和滚动结束解决方案,但没有像onIsScrolling ...
有内置的解决方案吗?或者最好的解决方法(nstimer)?
感谢 亚历
答案 0 :(得分:4)
UIScrollViewDelegate
提供以下内容:
– scrollViewDidScroll:
– scrollViewWillBeginDragging:
– scrollViewDidEndDragging:willDecelerate:
– scrollViewShouldScrollToTop:
– scrollViewDidScrollToTop:
– scrollViewWillBeginDecelerating:
– scrollViewDidEndDecelerating:
特别是:
– scrollViewDidScroll:
答案 1 :(得分:2)
非常感谢scrollViewDidScroll提示。 下面是实施样本:
@interface YourClass : UIViewController <UIScrollViewDelegate>
{
UIScrollView *theView;
}
@end
在.m文件中:
- (void)loadView
{
theView = [[UIScrollView alloc] initWithFrame:
CGRectMake(0, 10, 300, 300)];
theView.delegate = self;
[self.view addSubview:theView];
theView.contentSize = CGSizeMake(500, 500);
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
NSLog(@"SCROLL SCROLL SCROLL YOUR BOAT");
}