このコードを使用して、バナー画像を 1 つずつ読み込みます。
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];
}
しかし、しばらくしてから画像を次々と水平にスライドさせる必要があります。どうすればそれを達成できますか?