Created
October 8, 2011 01:40
-
-
Save mharper/1271728 to your computer and use it in GitHub Desktop.
Flippy Flippy
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
-(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