Created
November 11, 2010 03:07
-
-
Save alanjrogers/671924 to your computer and use it in GitHub Desktop.
Revisions
-
Alan Rogers created this gist
Nov 11, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ - (void)loadViewController:(UIViewController*)viewController withTransition:(AJRNavigationControllerTransition)transition { // This currently only works for a landscape only App. // Needs to check orientation as nav controller view isn't rotated. NSString* subtype = kCATransitionFromBottom; switch (transition) { case AJRNavigationControllerTransition_FromLeft: { subtype = ([self interfaceOrientation] == UIInterfaceOrientationLandscapeLeft) ? kCATransitionFromTop : kCATransitionFromBottom; break; } case AJRNavigationControllerTransition_FromRight: { subtype = ([self interfaceOrientation] == UIInterfaceOrientationLandscapeRight) ? kCATransitionFromTop : kCATransitionFromBottom; break; } default: break; } CATransition *animation = [CATransition animation]; [animation setDuration:0.25]; [animation setType:kCATransitionPush]; [animation setSubtype:subtype]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [[self.navigationController.view layer] addAnimation:animation forKey:@"SwitchToView1"]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.25]; [UIView setAnimationBeginsFromCurrentState:YES]; [self.navigationController pushViewController:viewController animated:NO]; [UIView commitAnimations]; }