Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I implement image Flip Animation in iphone app

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];
like image 356
Nila Avatar asked Dec 05 '12 04:12

Nila


2 Answers

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

#import <QuartzCore/QuartzCore.h>
like image 141
Asif Mujteba Avatar answered Oct 24 '22 06:10

Asif Mujteba


[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.

like image 36
alex Avatar answered Oct 24 '22 07:10

alex