如何在iPhone应用程序中实现图像翻转动画

Nil*_*ila 5 iphone animation ios

如何向右侧实现图像翻转动画.下面给出的代码.请帮助.

imageview.animationImages=[NSArray arrayWithObjects:  
   [UIImage imageNamed:@"image1.png"],
   [UIImage imageNamed:@"imag2.png"],
   [UIImage imageNamed:@"imag3.png"],
   [UIImage imageNamed:@"imag4.png"],
   [UIImage imageNamed:@"imag5.png"], 
   [UIImage imageNamed:@"imag6.png"],
   [UIImage imageNamed:@"imag7.png"], nil];

imageview.animationDuration=15.0;
imageview.animationRepeatCount=0;
[imageview startAnimating];
Run Code Online (Sandbox Code Playgroud)

Asi*_*eba 9

用于垂直翻转

[UIView animateWithDuration:1.0 animations:^{
    yourView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0,0.0);
} completion:^(BOOL finished){
    // code to be executed when flip is completed
}];
Run Code Online (Sandbox Code Playgroud)

用于水平翻转

[UIView animateWithDuration:1.0 animations:^{
    yourView.layer.transform = CATransform3DMakeRotation(M_PI,0.0,1.0,0.0);
} completion:^(BOOL finished){
    // code to be executed when flip is completed
}];
Run Code Online (Sandbox Code Playgroud)

并且不要忘记将QuartzCore框架添加到项目并导入

#import <QuartzCore/QuartzCore.h>
Run Code Online (Sandbox Code Playgroud)