[Fast hint] Simple animation with CoreAnimation
Let's create a simple animation to flip UIImageView and change your image
First Step
create a UIImageView object
@interface MyClass : UIViewController{
UIImageView *myImageVIew;
}
@end
set a default image
- (void)viewDidLoad {
[myImageView setImage:[UIImage imageNamed:@"image1.png"]];
}
Now let's to create the animation
-(void)flipAndChangeImage{
[UIView transitionWithView:myImageView duration:1 options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[myImageView setImage:[UIImage imageNamed:@"image2.png"]];
}
completion:NULL];
}
Now we call function flipAndChangeImage in a action for example
-(IBAction)callAnimation{
[self flipAndChangeImage];
}
We have done a little animation
We can use others effects for example
UIViewAnimationOptionTransitionFlipFromLeft UIViewAnimationOptionTransitionFlipFromRight UIViewAnimationOptionTransitionCurlUp UIViewAnimationOptionTransitionCurlDownFor this hint is all up to the next