- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender {
// We don't want a "feedback loop" between the UIPageControl and the scroll delegate in
// which a scroll event generated from the user hitting the page control triggers updates from
// the delegate method. We use a boolean to disable the delegate logic when the page control is used.
if (sender.tag!=789012) {
return;
}
// Switch the indicator when more than 50% of the previous/next page is visible
CGFloat pageWidth = bannerScrollView.frame.size.width;
int page = floor((bannerScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
NSLog(@"Page Count %d",page);
}
No comments:
Post a Comment