Skip to content

Instantly share code, notes, and snippets.

@mharper
Created October 8, 2011 01:40
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 mharper/1271728 to your computer and use it in GitHub Desktop.
Save mharper/1271728 to your computer and use it in GitHub Desktop.
Flippy Flippy
-(void) flipViews
{
// Animate the flipping of the current view to the opposite view.
UIView *fromView, *toView;
UIViewAnimationOptions flipDirection;
NSString *newButtonTitle;
if (mapView.superview)
{
fromView = mapView;
toView = moreView;
newButtonTitle = NSLocalizedString(@"Map", @"Map");
flipDirection = UIViewAnimationOptionTransitionFlipFromRight;
}
else
{
fromView = moreView;
toView = mapView;
newButtonTitle = NSLocalizedString(@"More", @"More");
flipDirection = UIViewAnimationOptionTransitionFlipFromLeft;
}
[UIView transitionFromView:fromView toView:toView duration:1.0 options:UIViewAnimationOptionCurveLinear | flipDirection completion:^(BOOL finished) {
self.navigationItem.leftBarButtonItem.title = newButtonTitle;
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment