How can I implement image flip animation towards right. the code given below. plz help .
如何实现图像向右翻转动画。下面的代码。请帮助。
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];
2 个解决方案
#1
9
for vertical flip
对垂直翻转
[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
}];
for horizontal flip
水平翻转
[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
}];
and don't forget to add QuartzCore framework to the project and importing
不要忘记向项目添加QuartzCore框架并导入
#import <QuartzCore/QuartzCore.h>
#2
2
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:imageview cache:NO];
[UIView commitAnimations];
I think This code may help you.
我认为这段代码可以帮助你。
#1
9
for vertical flip
对垂直翻转
[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
}];
for horizontal flip
水平翻转
[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
}];
and don't forget to add QuartzCore framework to the project and importing
不要忘记向项目添加QuartzCore框架并导入
#import <QuartzCore/QuartzCore.h>
#2
2
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:imageview cache:NO];
[UIView commitAnimations];
I think This code may help you.
我认为这段代码可以帮助你。