I am using the following two UIScrollView delegate methods to call another method in my UIViewController:
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
// do something
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
// do something
}
I've tried various different ways of calling //do something but either end up with both not being called, or both delegate methods being called, calling //do something twice in certain situations. For example:
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
if(![scrollView isDecelerating] && ![scrollView isDragging]){
//do something
}
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
if(!decelerate){
//do something
}
}
So with the above if I scroll and let it slow to a stop, it calls scrollViewDidEndDecelerating:, but if I scroll and stop it with a tap it calls both scrollViewDidEndDragging: and scrollViewDidEndDecelerating:
I want it to call one or the other... is there something I can do with scrollViewDidEndDecelerating: and the scrollView object to stop this double method call?
scrollViewDidScrollmethod instead if you dont have any complex things to do? - visakh7