我正在使用此代碼逐個加載橫幅圖像。水平滑動橫幅圖像
NSArray *imagesArray;
int photoCount;
UIImageView *imageView;
-(void)setupImageView{
photoCount = 0;
[[NSArray alloc]initWithObjects:[UIImage imageNamed:@"imgA.png"] ,
[UIImage imageNamed:@"imgB.png"] ,
[UIImage imageNamed:@"imgC.png"] ,
[UIImage imageNamed:@"imgD.png"] ,
[UIImage imageNamed:@"imgE.png"] ,
nil];
imageView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, width, height)];
imageView.image = [imagesArray objectAtIndex:photoCount];
[self.view addSubview:imageView];
[NSTimer scheduledTimerWithTimeInterval:20.0 target:self selector:@selector(transitionPhotos) userInfo:nil repeats:YES];
}
-(void)transitionPhotos{
if (photoCount < [imagesArray count] - 1){
photoCount ++;
}else{
photoCount = 0;
}
[UIView transitionWithView:self.imageView
duration:2.0
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{ imageView.image = [imagesArray objectAtIndex:photoCount]; }
completion:NULL];
}
但我需要在一段時間間隔之後水平地一個接一個地水平滑動圖像。我怎樣才能做到這一點?
thankyou iBhavesh..this是第二次你幫我:)謝謝你非常多 – rakesh
你已經幫我在這個主題「如何通過從ios中的數據庫獲取數據填充數據到UItableView [暫停] 「 – rakesh
okey :) ....... – rakesh