Skip to content

Instantly share code, notes, and snippets.

@MosheBerman
Created April 11, 2013 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MosheBerman/5366396 to your computer and use it in GitHub Desktop.
Save MosheBerman/5366396 to your computer and use it in GitHub Desktop.
Animation transitions...
- (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