iphone - How can I detect next page number of UIScrollView which is 'scrollView.pagingEnabled' = YES? in 'scrollViewDidEndDragging'? -


i searched several stuffs on stackoverflow

cgfloat pagewidth = scrollview.frame.size.width; int pagenumbertobescrolled = floor((scrollview.contentoffset.x - pagewidth / 2) / pagewidth) + 1; if (pagenumbertobescrolled != 1) {     // want } 

in

- (void)scrollviewdidenddragging:(uiscrollview *)scrollview willdecelerate:(bool)decelerate; 

but works if scrolled scrolling page moved on half of it. doesn't work if scrolled fast swipe. scrolled 30% of scrolling page, doesn't satisfy situation on there, scrolled next page, , want detect it.

how can detect or catch scroll-to-next-page situations? please give me :)

edit

i working on because want play effect sound when scroll-to-next-page happens. should detect right after finger off screen , next page scrolling. think if handle on scrollviewdidenddragging, it'll best me :)

i'm using code detect if currentpage changed, doesn't matter scroll fast or slow.

- (void)scrollviewdidscroll:(uiscrollview *)scrollview {         static nsinteger previouspage = 0;         cgfloat pagewidth = scrollview.frame.size.width;         float fractionalpage = scrollview.contentoffset.x / pagewidth;         nsinteger page = lround(fractionalpage);         nslog(@"%d",page);         if (previouspage != page) {             previouspage = page;             /* page did change */         }   } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -