0

I added UITabBarViewController to my app and added five ViewControllers. Each VC to one of the TabBarItems. And all of this is working good. But for the third view is made for user to input some data, so I want it to be presented as temporary VC. The usual transition for temporary VC is crossdisolve. This brings the VC up from the bottom.

So my question is how can I make this animation for transition between TabBarItems.

Haroldo Gondim
  • 7,725
  • 9
  • 43
  • 62
Klemen
  • 2,144
  • 2
  • 23
  • 31
  • possible duplicate of [iPhone: How to switch tabs with an animation?](http://stackoverflow.com/questions/5161730/iphone-how-to-switch-tabs-with-an-animation) – rob mayoff Oct 18 '12 at 23:27

1 Answers1

0

I use this function which takes in the index of the destination view. I would add this function as part of the parent view controller to be called by the sub-view controllers. That's up to you.

-(void) animateTabBarTransition:(NSInteger) destinationTabIdx{
   UIView * fromView = self.tabBarController.selectedViewController.view;
   UIView * toView = [[self.tabBarController.viewControllers objectAtIndex:destinationTabIdx] view];

  [UIView transitionFromView:fromView toView:toView duration:0.8
    options:(destinationTabIdx > self.tabBarController.selectedIndex ? UIViewAnimationOptionTransitionFlipFromLeft: UIViewAnimationOptionTransitionFlipFromRight)
            completion:^(BOOL finished) {
                if (finished) {
                    self.tabBarController.selectedIndex = destinationTabIdx;
                }
}];

}

gps
  • 317
  • 5
  • 10