0
我正在iPhone應用程序中工作,使用UIScrollView設置爲水平,在UIScrollView中添加5個圖像,並且其工作正常。 (我想在開放時間顯示第二張圖片)然後,我試着在屏幕顯示時,在第二張圖片顯示時。但我想我的最好水平,但我沒有做到這一點,請任何一個幫助我iPhone中的UIScrollView?
在此先感謝
我嘗試這樣做:
UIScrollView *scroll1 = [[UIScrollView alloc] initWithFrame:CGRectMake(10, 45, 300, 360)];
scroll1.contentSize=CGSizeMake(2700, 360);
[scroll1 setShowsHorizontalScrollIndicator:NO];
scroll1.pagingEnabled=YES;
[self.view addSubview:scroll1];
UIImageView *SlideImage = [[UIImageView alloc]initWithFrame:CGRectMake(0,0, 300, 360)];
SlideImage.image=[UIImage imageNamed:@"img1.png"];
SlideImage.backgroundColor=[UIColor clearColor];
[scroll1 addSubview:SlideImage];
UIImageView *SlideImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(300,0, 300, 360)];
SlideImage1.image=[UIImage imageNamed:@"img2.png"];
SlideImage1.backgroundColor=[UIColor clearColor];
[scroll1 addSubview:SlideImage1];
UIImageView *SlideImage2 = [[UIImageView alloc]initWithFrame:CGRectMake(600,0, 300, 360)];
SlideImage2.image=[UIImage imageNamed:@"img3.png"];
SlideImage2.backgroundColor=[UIColor clearColor];
[scroll1 addSubview:SlideImage2];
UIImageView *SlideImage3 = [[UIImageView alloc]initWithFrame:CGRectMake(900,0, 300, 360)];
SlideImage3.image=[UIImage imageNamed:@"img4.png"];
SlideImage3.backgroundColor=[UIColor clearColor];
[scroll1 addSubview:SlideImage3];
UIImageView *SlideImage4 = [[UIImageView alloc]initWithFrame:CGRectMake(1200,0, 300, 360)];
SlideImage4.image=[UIImage imageNamed:@"img5.png"];
SlideImage4.backgroundColor=[UIColor clearColor];
[scroll1 addSubview:SlideImage4];
UIImageView *SlideImage5 = [[UIImageView alloc]initWithFrame:CGRectMake(1500,0, 300, 360)];
SlideImage5.image=[UIImage imageNamed:@"img6.png"];
SlideImage5.backgroundColor=[UIColor clearColor];
[scroll1 addSubview:SlideImage5];
謝謝你這麼多 – SampathKumar
你爲你的答案增加你的投票,爲其他答案投下你的答案 – NANNAV
你做虛擬投票增加你在這個賬戶中的聲望 – NANNAV