Created
May 30, 2012 11:36
-
-
Save dcastro/2835703 to your computer and use it in GitHub Desktop.
iOS 3 types of crossfade animations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[UIView animateWithDuration:0.3 animations:^() { | |
self.commentContentLabel.alpha = (editing)? 0.0 : 1.0; | |
}]; | |
//////////////// | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:1.0]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.commentContentLabel cache:YES]; | |
self.commentContentLabel.hidden = editing; | |
[UIView commitAnimations]; | |
/////////////////// | |
UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionTransitionCrossDissolve; | |
[UIView transitionWithView:self.bottomScrollView | |
duration:0.3 | |
options:options | |
animations:^{ | |
self.commentContentLabel.hidden = editing; | |
self.commentContentTextView.hidden = !editing; | |
} | |
completion:NULL]; | |
//////// CORE ANIMATION | |
#import <QuartzCore/QuartzCore.h> | |
CATransition *transition = [CATransition animation]; | |
transition.duration = 0.8; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionPush; | |
transition.subtype = kCATransitionFromLeft; | |
transition.delegate = self; | |
[[[[[self view] subviews] objectAtIndex:0] layer] addAnimation:transition forKey:nil]; | |
[currentVC viewWillAppear:YES]; | |
[destinationVC viewWillDisappear:YES]; | |
[destinationVC viewDidDisappear:YES]; | |
[currentVC viewDidAppear:YES]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment