/// 左右滚动方法
/// @param scrollView scrollView description
/// @param max 最大页数
/// @param isUp YES 上一个 NO 下一下
/// @param width 滚动宽度
-(void)scrollViewRollFromScrollView:(UIScrollView *)scrollView
max:(NSInteger)max
isUp:(BOOL)isUp
width:(CGFloat)width
{
CGPoint offset = scrollView.contentOffset;
NSInteger index = offset.x / width;
if (isUp == YES)
{
if (index <= 0)
{
return ;
}
CGFloat offsetX = index * width - width;
[scrollView setContentOffset:CGPointMake(offsetX, 0) animated:NO];
}
else
{
if (index > max - 2 )
{
return ;
}
CGFloat offsetX = index * width + width;
[scrollView setContentOffset:CGPointMake(offsetX, 0) animated:NO];
}
}