I searched several stuffs on stackoverflow like
CGFloat pageWidth = scrollView.frame.size.width;
int pageNumberToBeScrolled = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
if (pageNumberToBeScrolled != 1) {
// Do what I want
}
in
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
But this works only if I scrolled slowly so scrolling page is definitely moved over half of it. This doesn't work if I scrolled fast like swipe. I just scrolled like 30% of scrolling page, which doesn't satisfy the situation over there, but it scrolled to next page, and I want to detect it.
How can I detect or catch all scroll-to-next-page
situations? Please give me some help :)
EDIT
I working on this because I want to play a effect sound when scroll-to-next-page happens. I should detect right after my finger is off the screen and only for next page scrolling. I think if I handle this on scrollViewDidEndDragging
, it'll be best for me :)