如何翻转 viewDidLoad 中的图像数组?

how to flip array of images in viewDidLoad?

我正在学习核心动画 iOS 首先我必须知道如何在视图中翻转图像数组

这里是我的示例代码:

NSArray *animationArray=[NSArray arrayWithObjects:
                         [UIImage imageNamed:@"homebg.png"],
                         [UIImage imageNamed:@"splash.jpg"],
                         [UIImage imageNamed:@"index3.png"],
                         [UIImage imageNamed:@"image2.png"],
                         [UIImage imageNamed:@"image4.png"],
                         [UIImage imageNamed:@"index6.png"],
                         nil];

imageView.backgroundColor=[UIColor purpleColor];
imageView.animationImages=animationArray;
imageView.transform = CGAffineTransformMakeScale(-1, 1);
imageView.animationDuration=3.9;
imageView.animationRepeatCount=0;
[imageView startAnimating];

它奏效了,但我不满意我希望图像具有动画效果并吸引最终用户

// in view Load
_slide = 0
[self changeSlide];

// Loop gallery 
NSTimer *timer = [NSTimer timerWithTimeInterval:5.0f target:self selector:@selector(changeSlide) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];


- (void)changeSlide
{

if(_slide > _galleryImages.count-1) _slide = 0;

UIImage *toImage = [UIImage imageNamed:_galleryImages[_slide]];
[UIView transitionWithView:_yourimageView
                  duration:0.6f
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                animations:^{
                    _yourimageView.image = toImage;

                } completion:nil];
_slide++;
//    }
}

创建一个计时器和图像数组。使用各种Flip动画选项为您的图像制作动画,希望这对您有所帮助