Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bottom layout guide length issue with tabbar after pushing

So my problem is related to auto-layout and the bottom layout guide.

Here's the design of the app:

UITabBarController

^-- Tab1: NavigationController with VC1 as root

^-- VC2 is pushed and hides the tab bar (full screen, top layout is situated under the nav bar, bottom layout should be the lowest pixel).

When VC2 is pushed, the bottom layout guide is 49 points length during a small amount of time and then it's 0.

During this time, my subviews which are constrained to this bottom guide are positioned incorrectly.

When the guide is then correctly set to 0 (by the navigation controller itself, there's no code from me regarding this), the subviews positions are then perfect.

cast

This does not happen on iOS 7.x (the app supports 7.0+)... I'm pretty sure that's a iOS 8 bug and I was looking for a workaround, but I could not find something that fixes this.

I tried to solve the issue forcing the navigation controllers'view to layout in view(Will/Did)LayoutSubviews, but it did not help.

I saw this post is related but the suggested solution does not work. Presenting the VC2 modally solves the issue but that's not acceptable.

  • Here's a video showing the issue
  • And I created a small project here that contains this bug.

Thanks in advance for your help, let me know if you need more explanations

like image 864
Romain Avatar asked Oct 01 '14 22:10

Romain


3 Answers

I'm having a similar issue like this with a UIPageViewController. After some initial research it does appears to be a bug. The only way I have managed to resolve this is to pin the subview to the superview instead of the bottom layout guide like so.

Pin to superview image

The constraint does seem to be respected once the subview is pinned to the superview.

Hope this helps.

like image 163
Darryl Bayliss Avatar answered Nov 09 '22 11:11

Darryl Bayliss


If you are using Auto Layout, try unchecking "Extend Edges->Under Bottom Bars" setting for TabBarController and all its ViewControllers in Interface Builder.

like image 29
Borzh Avatar answered Nov 09 '22 11:11

Borzh


I solved my issue by setting the tabbar translucent as No

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.translucent = NO;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.translucent = self.isTabBarTranslucent;
}
like image 1
Away Lin Avatar answered Nov 09 '22 12:11

Away Lin