I have an ScrollView for display PDF Pages. When I scroll the this shows me the second Page with paging enabled in ScrollView. I set the bounce property false for Scrolling. I want to display page number that which page is being Displayed. For that I am had used following code..
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (scrollView == scrlView) {
if (lastContentOffsetX > scrollView.contentOffset.x) {
if (currentPage > 1) {
currentPage--;
self.title = [NSString stringWithFormat:@"%d/%d", currentPage, totalPages];
}
}
else if (lastContentOffsetX < scrollView.contentOffset.x) {
if (currentPage < totalPages) {
currentPage++;
self.title = [NSString stringWithFormat:@"%d/%d", currentPage, totalPages];
}
}
lastContentOffsetX = scrollView.contentOffset.x;
}
}
I don't have any problem if every time I drag and the page changes. Some time I drag a very little time and the page doesn't change and remain the same. My page number get Increased/decreased.
Can Any body tell me if I can get any event when ScrollView Stops Scrolling I can get the current offset and complete my task.
Try
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
and/or
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView