我有 20 个数组图像。添加包含滚动视图的图像图像视图。垂直滚动 20 图像。现在我的要求是给滚动效果
例如在 20 1 2 3 4.. 之后同样显示图像。
我试过那个但不适合我
- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender
{
NSLog(@"%f",scrollView.contentOffset.x);
// The key is repositioning without animation
if (scrollView.contentOffset.x == 0) {
// user is scrolling to the left from image 1 to image 4
// reposition offset to show image 4 that is on the right in the scroll view
// [scrollView scrollRectToVisible:CGRectMake(1280,0,320,416) animated:NO];
[scrollView scrollRectToVisible:CGRectMake(6080, 0, 320, 416) animated:NO];
}
else if (scrollView.contentOffset.x == 6400) {
// user is scrolling to the right from image 4 to image 1
// reposition offset to show image 1 that is on the left in the scroll view
[scrollView scrollRectToVisible:CGRectMake(0,0,320,416) animated:NO];
//[scrollView scrollRectToVisible:CGRectMake(0, 0, 0, 0) animated:YES];
}
}
提前帮我解决这个问题。