skip to Main Content

I just noticed when building my app with Xcode 16 (iOS 18) that the screen flashes briefly when switching tabs (using a standard UITabBarController). Have any one of you experienced it? I have searched documentation and can not find anything mentioning changes in the behaviour. I also tried implementing the following methods of UITabBarControllerDelegate:

func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> (any UIViewControllerAnimatedTransitioning)? {
        nil
    }
func tabBarController(_ tabBarController: UITabBarController, interactionControllerFor animationController: any UIViewControllerAnimatedTransitioning) -> (any UIViewControllerInteractiveTransitioning)? {
        nil
    }

How can I get rid of the flashing?

Showing flashing when switching tabs

2

Answers


  1. Chosen as BEST ANSWER

    Temporarily solved it by setting UIView.setAnimationsEnabled(false) in func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool

    And then setting UIView.setAnimationsEnabled(true) in func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController)


  2. Objective-C solution for @PeterWarbo’s Swift solution.

    self.tabBarController.delegate = self;
    
    - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
        [UIView setAnimationsEnabled:NO];
        return YES;
    }
    
    - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
        [UIView setAnimationsEnabled:YES];
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search