我已经实现了一个 UIScrollView。它包含 60 宽度大小的小图像。滚动运动总是向前或向后步进 3 张图片,而不是我需要的一张一张。请参阅解释这一点的附图。
ScrollView 已启用分页。这是代码:
for (int i = 0; i < numberOfViews; i++) {
UIImage *myImage = [UIImage imageNamed:[fotosJugadores objectAtIndex:i]];
CGFloat yOrigin = i * myImage.size.width + 120;
UIImageView *awesomeView = [[UIImageView alloc] initWithFrame:CGRectMake(yOrigin, 0, myImage.size.width, myImage.size.height)];
awesomeView.image = myImage;
awesomeView.tag = i;
[self.jugadorSlide addSubview:awesomeView];
awesomeView=nil;
}
[jugadorSlide setBackgroundColor:[UIColor blackColor]];
jugadorSlide.contentSize = CGSizeMake(65 * numberOfViews+240,78);
jugadorSlide.layer.cornerRadius = 11;
jugadorSlide.layer.masksToBounds = YES;
[jugadorSlide setContentOffset:CGPointMake(((65 * numberOfViews)/2), 0)];
[self scrollViewDidEndDecelerating:jugadorSlide];
非常感谢