Created
April 11, 2013 19:20
-
-
Save MosheBerman/5366396 to your computer and use it in GitHub Desktop.
Animation transitions...
This file contains hidden or 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
- (void) flipInWithCompletion:(MBTransitionCompletion)completion | |
{ | |
BOOL displayingPrimary = [self isDisplayingPrimaryView]; | |
UIView *frontView = [self frontView]; | |
UIView *backView = [self backView]; | |
UIView *wrapperView = [self wrapperView]; | |
[wrapperView addSubview:frontView]; | |
[UIView transitionWithView:wrapperView | |
duration:0.8 | |
options:UIViewAnimationOptionTransitionFlipFromRight | |
animations:^{ | |
[wrapperView addSubview:backView]; | |
[frontView removeFromSuperview]; | |
} | |
completion:^(BOOL finished) { | |
[self setIsDisplayingPrimaryView:!displayingPrimary]; | |
if (completion) { | |
completion(); | |
} | |
} | |
]; | |
} | |
- (void) flipOutWithCompletion:(MBTransitionCompletion)completion | |
{ | |
BOOL displayingPrimary = [self isDisplayingPrimaryView]; | |
UIView *primaryView = [self frontView]; | |
UIView *secondaryView = [self backView]; | |
UIView *wrapperView = [self wrapperView]; | |
[UIView transitionWithView:wrapperView | |
duration:0.8 | |
options:UIViewAnimationOptionTransitionFlipFromLeft | |
animations:^{ | |
[self addSubview:primaryView]; [secondaryView removeFromSuperview]; | |
} | |
completion:^(BOOL finished) { | |
[self setIsDisplayingPrimaryView:!displayingPrimary]; | |
if (completion) { | |
completion(); | |
} | |
} | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment