1.主要代码
- (void)moveItem:(CGFloat)itemY{
if (itemY >= ITEM_HEIGHT * ([self.items count] -1) ) {
itemY = 0;
// 设置偏移量
[_scrollView setContentOffset:CGPointMake(0,itemY) animated:NO];
[self.scrollView setContentOffset:CGPointMake(0, ITEM_HEIGHT) animated:YES];
}
// 如果小于第一页
else if(itemY <= 0)//0
{
itemY = ITEM_HEIGHT*([self.items count]-2) ;
[_scrollView setContentOffset:CGPointMake(0,itemY) animated:NO];
}
else
[self.scrollView setContentOffset:CGPointMake(0, itemY) animated:YES];
}
2.代码链接:http://download.csdn.net/download/sunnysu99/10009153