嗨我期待看看我是否可以採用我在下面創建的滾動視圖,並在第3或第4張圖片上啓動滾動視圖,而不是從頭開始滾動視圖。基本上我不想讓它從第一張圖片開始,但仍然能夠向後滾動以獲得它們。這可能嗎?謝謝!開始ScrollView除了第一張圖片
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;
}