我已经定了!
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGPoint scrollOffset=scrollView.contentOffset;
int pagAtual = scrollOffset.x/scroll.frame.size.width;
if(pagAtual != 0) { //always release all imageViews and load the current and next
for(int iCnt = 0; iCnt < [scroll.subviews count]; iCnt++) {
UIView *viewLiberar = [scroll.subviews objectAtIndex:iCnt];
if ([viewLiberar isKindOfClass:UIImageView.class]) {
[viewLiberar removeFromSuperview];
viewLiberar = nil;
}
}
}
if(pageOnScrollView < ((int)scrollOffset.x/scroll.frame.size.width))
{
//load the next page
[self loadNextPage:(pagAtual)];
[self loadNextPage:(pagAtual + 1)];
}
else if(pageOnScrollView > ((int)scrollOffset.x/scroll.frame.size.width))
{
if(pagAtual>0)[self loadNextPage:((int)scrollOffset.x/scroll.frame.size.width)-1];
}
pageOnScrollView=scrollOffset.x/scroll.frame.size.width;
}