Ios 如何在viewDidLoad中翻转图像数组?

Ios 如何在viewDidLoad中翻转图像数组?,ios,iphone,uiimage,core-graphics,Ios,Iphone,Uiimage,Core Graphics,我正在学习iOS中的核心动画,首先我必须知道如何在视图中翻转图像阵列 下面是我的示例代码: NSArray *animationArray=[NSArray arrayWithObjects: [UIImage imageNamed:@"homebg.png"], [UIImage imageNamed:@"splash.jpg"], [UIIma

我正在学习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
Animation选项为您的图像设置动画,希望这对您有所帮助


thanx对于你的答案,我可以知道什么是幻灯片吗?我指的是它的声明?它是一个整数,默认值是
0
\u gallerymages[\u slide]
有助于通过索引和递增使用动画中的任意一个来访问图像
UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionTransitionFlipFromBottom
我还观看了演示,了解它是如何工作的。请检查编辑。为什么不是否将翻转的图像保存在另一个数组中,并逐个执行动画?