I am having trouble trying to make the UITabBarViewController perform the same animation that UINavigationController has when it performs pushViewController.
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
UIViewController *currentVC = [tabBarController selectedViewController];
if (currentVC == viewController)
return NO;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
UIModalTransitionStyle transition = UIModalTransitionStyleFlipHorizontal;
[UIView setAnimationTransition:transition forView:tabBarController.view cache:YES];
[currentVC viewWillAppear:YES];
[viewController viewWillDisappear:YES];
[viewController viewDidDisappear:YES];
[currentVC viewDidAppear:YES];
[UIView commitAnimations];
return YES;}
The following code performs an animation when switching tabs:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
UIViewController *currentVC = [tabBarController selectedViewController];
if (currentVC == viewController)
return NO;
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:tabBarController.view cache:YES];
[currentVC viewWillAppear:YES];
[viewController viewWillDisappear:YES];
[viewController viewDidDisappear:YES];
[currentVC viewDidAppear:YES];
[UIView commitAnimations];
return YES;}
How can I modify the code above to perform the slide from the right animation similar to pushing a a viewController into the navigation controller?