0

I currently have the following "controller tree":

UITabBarController
┣━ UIViewController (A)
┃ ┗ MKMapView
┣━ UINavigationController
┃ ┣━ UITableViewController (X)
┃ ┗━ UITableViewController (B)
┣━ UIViewController (not interesting)
┗━ UIViewController (not interesting)

In second view (B) i have button connected to the IBAction:

- (IBAction)mapButtonTapped:(UIBarButtonItem *)sender {
        UIView *startView = self.tabBarController.selectedViewController.view;
        UIView *endView = ((UIViewController *)[self.tabBarController.viewControllers objectAtIndex:ELMapViewControllerIndex]).view;
        ElMainMapViewController *carparkVC = [self.tabBarController.viewControllers objectAtIndex:ELMapViewControllerIndex];
        [UIView transitionFromView:startView toView:endView duration:ELAnimationDuration
                           options:UIViewAnimationOptionTransitionCrossDissolve
                        completion:^(BOOL finished) {
                        }];
    }

The code has been taken from: iPhone: How to switch tabs with an animation?

Everything works perfeclty fine - When button i click on the button my second tab view slighty changes to first and everything works as I want to.

Unfortunately my QA clicked simultaneously back button and button connected to the function above. That sometimes cause locking UITabBar. I'm able to move MKMapView and any subview but UITabBar behave like with disabled user interaction.

If this "combo" doesn't lock UITabBar it sometimes cause "<" sign near back button in B ViewController is much thinner then it should be.

I really don't have any idea how to solve this problem. I checked viewWillAppear and other function but none of have a deal with UITabBar (I don't keep reference in any other function to UITabBar).

EDIT

I removed changing selected index in tabBar and this issue still appears.

Community
  • 1
  • 1
Szu
  • 2,203
  • 1
  • 18
  • 35

1 Answers1

0

You need to disable the controls before starting the animation re-enable them in the completion block.

For each item use something like:

[[[[self.tabBarController tabBar] items] objectAtIndex:1] setEnabled:NO];

and then setEnabled:YES on animation completion.

Vincent Guerci
  • 14,094
  • 4
  • 47
  • 55
jamihash
  • 1,864
  • 1
  • 12
  • 14