@ user652878 Это отвечает на ваш вопрос о безрадостном выцветании от одного изображения к следующему:
Создайте следующие свойства в заголовке контроллеров представления:
UIImageView *imageViewBottom, *imageViewTop;
NSArray *imageArray;
Затем добавьте этот код в свойфайл имплиментации:
int topIndex = 0, prevTopIndex = 1;
- (void)viewDidLoad {
imageViewBottom = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];
[self.view addSubview:imageViewBottom];
imageViewTop = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];
[self.view addSubview:imageViewTop];
imageArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"lori.png"],
[UIImage imageNamed:@"miranda.png"],
[UIImage imageNamed:@"taylor.png"],
[UIImage imageNamed:@"ingrid.png"],
[UIImage imageNamed:@"kasey.png"],
[UIImage imageNamed:@"wreckers.png"], nil];
NSTimer *timer = [NSTimer timerWithTimeInterval:5.0
target:self
selector:@selector(onTimer)
userInfo:nil
repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
[timer fire];
[super viewDidLoad];
}
-(void)onTimer{
if(topIndex %2 == 0){
[UIView animateWithDuration:5.0 animations:^
{
imageViewTop.alpha = 0.0;
}];
imageViewTop.image = [imageArray objectAtIndex:prevTopIndex];
imageViewBottom.image = [imageArray objectAtIndex:topIndex];
}else{
[UIView animateWithDuration:5.0 animations:^
{
imageViewTop.alpha = 1.0;
}];
imageViewTop.image = [imageArray objectAtIndex:topIndex];
imageViewBottom.image = [imageArray objectAtIndex:prevTopIndex];
}
prevTopIndex = topIndex;
if(topIndex == [imageArray count]-1){
topIndex = 0;
}else{
topIndex++;
}
}