嗨,我想看看我是否可以使用我在下面创建的滚动视图并在第 3 或第 4 张图像上启动滚动视图,而不是从头开始滚动视图。基本上我不希望它从第一张图像开始,但仍然能够向后滚动以找到它们。这可能吗?谢谢!
int PageCount = 34;
NSMutableArray *arrImageName =[[NSMutableArray alloc]initWithObjects:@"4miley.png",@"4BP1-2.png",@"S2-4.png",@"D3-4.png",@"4BP1-1.png",@"F2-4.png",@"B6-4.png",@"D6-4.png",@"4BP1-3.png",@"S1-4.png",@"B7-4.png", @"D2-4.png",@"F7-4.png",@"B1-4.png",@"F3-4.png",@"4BP1-4.png",@"D5-4.png",@"S3-4.png",@"B2-4.png",@"F5-4.png",@"D4-4.png",@"S7-4.png",@"F1-4.png",@"B3-4.png",@"S4-4.png",@"F6-4.png",@"D1-4.png",@"4BP1-5.png",@"B4-4.png",@"S5-4.png",@"F4-4.png",@"D7-4.png",@"S6-4.png",@"B5-4.png",nil];
scroller = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
scroller.scrollEnabled=YES;
scroller.backgroundColor = [UIColor clearColor];
[scroller setShowsHorizontalScrollIndicator:NO];
scroller.pagingEnabled = YES;
scroller.bounces = NO;
scroller.delegate = self;
[self.view addSubview:scroller];
width=scroller.frame.size.width;
xPos=0;
for (int i=0; i<PageCount; i++)
{
ImgView = [[UIImageView alloc]initWithFrame:CGRectMake(xPos, 0, scroller.frame.size.width, scroller.frame.size.height)];
[ImgView setImage:[UIImage imageNamed:[arrImageName objectAtIndex:i]]];
[scroller addSubview:ImgView];
scroller.contentSize = CGSizeMake(width, 0);
width +=scroller.frame.size.width;
xPos +=scroller.frame.size.width;
}