Reputation: 511
is there a method / possibility to run a function when the scrollview is scrolling?
i found scroll start and scroll end solutions but nothing like a onIsScrolling ...
is there a built in solution? or whats the best workaround (nstimer)?
thanks Alex
Upvotes: 2
Views: 2441
Reputation: 511
Thanks a lot for the scrollViewDidScroll tip. heres the implemtation sample:
@interface YourClass : UIViewController <UIScrollViewDelegate>
{
UIScrollView *theView;
}
@end
in .m file:
- (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");
}
Upvotes: 2
Reputation: 3863
UIScrollViewDelegate
provides the following:
– scrollViewDidScroll:
– scrollViewWillBeginDragging:
– scrollViewDidEndDragging:willDecelerate:
– scrollViewShouldScrollToTop:
– scrollViewDidScrollToTop:
– scrollViewWillBeginDecelerating:
– scrollViewDidEndDecelerating:
in particular:
– scrollViewDidScroll:
Upvotes: 4