10

I've recently added support to iOS 11 on my app and this started happening. Basically, whenever a ViewController is added to the navigation stack the tab bar glitches out during the animation.

It only happens in iPhone X, and this is just a regular TabBarController. What's causing it?

What's going on

Bruno Rocha
  • 998
  • 8
  • 13
  • Have you hidden your status bar in the pushed view controller? – badhanganesh Oct 03 '17 at 18:27
  • No, there's no change at the moment of the push, and it happens regardless of what ViewController I push... – Bruno Rocha Oct 03 '17 at 18:33
  • Please show us your code. – badhanganesh Oct 03 '17 at 18:37
  • There's nothing besides `coordinator.rootViewController.hidesBottomBarWhenPushed = true` and `rootViewController.navigationController?.pushViewController(coordinator.rootViewController, animated: true)`, i've even removed every content of the views and it still happen. I've found someone else with the same problem: https://stackoverflow.com/questions/46232929/why-page-push-animation-tabbar-moving-up-in-the-iphone-x , seems like an iOS glitch. – Bruno Rocha Oct 03 '17 at 19:12
  • Just had the same issue with my app. Even with a plain test-project... I filed a bug-report for Apple... – Georg Oct 17 '17 at 08:38
  • I've also filed a bug report with Apple. Please duplicate radar #35098813 http://www.openradar.me/35098813 – Rob MacEachern Oct 20 '17 at 20:12
  • @BrunoRocha - Have u solved this problem ? Facing same please help. – Pankaj Gupta Nov 02 '17 at 07:03
  • @PankajGupta I haven't, but a new Xcode has come out with "iPhone X simulator improvements", perhaps they fixed it but I haven't downloaded it yet – Bruno Rocha Nov 03 '17 at 10:48

1 Answers1

1

Additional answer

A radar is open about this problem here.

- (void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];

    // Disable tabBar shifts upward whenever a ViewController is pushed on iPhone X rdar://35098813
    BOOL isIPhoneX = ...
    if (isIPhoneX && UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
        [self.tabBar setFrame:CGRectMake(0, CGRectGetHeight(self.view.frame) - CGRectGetHeight(self.tabBar.frame), CGRectGetWidth(self.view.frame), CGRectGetHeight(self.tabBar.frame))];
    }
}

Original answer

I think this is a bug of iOS 11. You can remove that weird effect to put down this code to your subclass of UITabBarController.

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    BOOL isIPhoneX = ...
    if (isIPhoneX && UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
        [self.tabBar setFrame:CGRectMake(0, self.view.frame.size.height - 83, 375, 83)];
    }
}

The solution is weird, too. :)

Jordan Montel
  • 8,227
  • 2
  • 35
  • 40
MG Han
  • 2,820
  • 2
  • 9
  • 7