- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
int index = fabs(_theScrollView.contentOffset.x)/self.view.frame.size.width;
if(_lastPageIndex == index) {
_lastPageIndex++;
} else{
_lastPageIndex = index;
}
if (_lastPageIndex>index){
//在这里,就是已经在最后一页,继续滚动,则触发你想要的事件。 其实只是add了一个小小的 int。
}
}
下面是scrollview初始化:
_theScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height)];
_theScrollView.userInteractionEnabled = YES;
_theScrollView.directionalLockEnabled = YES;
_theScrollView.pagingEnabled = YES;
_theScrollView.showsVerticalScrollIndicator = NO;
_theScrollView.showsHorizontalScrollIndicator = NO;
_theScrollView.delegate = self;
_theScrollView.contentSize = CGSizeMake(self.view.frame.size.width*5, self.view.frame.size.height);