Uitabbar Items Jumping on Back Navigation on iOS 12.1

UITabBar items jumping on back navigation on iOS 12.1

In your UITabBarController, set isTranslucent = false

Incorrect display of items on UITabBarController

In your UITabBarController, set
isTranslucent = false

thanks Vanya

How to correct Tab Bar height issue on iPhone X

"File inspector"

"File inspector" from right of Xcode storyboard, enable Safe Area guide layout to support your app in iPhone

This post describes it really well.

Weird frame calculation for UITabBar

I found the same behavior on iOS9 in two cases:

1) while immediate rotation during the pop-navigation in UINavigationController;

2) on rotation from landscape to portrait while watching full-screen video player and closing player after that.

To solve the problem on iOS8+ you should subclass UITabBarController and implement method from UIContentContainer protocol as follows:

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];

if (!self.tabBar.window) return;

[coordinator animateAlongsideTransition: ^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
CGRect newBounds = self.tabBar.bounds;
newBounds.size.width = size.width;
self.tabBar.bounds = newBounds;

[self.view.superview setNeedsLayout];
}
completion: nil];
}

If you don't write return string you won't fix the 2nd issue.

Adding same in Swift:

extension UITabBarController {
public override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
if let _ = self.tabBar.window {
coordinator.animateAlongsideTransition( { (context) in
self.tabBar.bounds.size.width = size.width
self.view.superview?.setNeedsLayout()
}, completion: nil)
}
}
}


Related Topics



Leave a reply



Submit