Search code examples
iosautolayoutpushviewcontroller

pushViewController cause autoLayout issue using hidesBottomBarWhenPushed (iphone6)


I have a FirstViewController with TabBarController and NavigationController (TabBarController > NavigationController > UIViewController)

When pressing the UIButton on the firstViewController, it will push to the SecondViewController.

SecondViewController *vc2 = [self.storyboard instantiateViewControllerWithIdentifier:@"BVC"];

vc2.hidesBottomBarWhenPushed = YES;

[self.navigationController pushViewController:vc2 animated:YES];

In SecondViewController there is an UILabel on the lower right corner with Constraints - ( Width-Equal, Height-Equal, TrailingSpaceToSuperView = 16,BottomSpaceToBottomLayoutGuide = 20 )

The result work fine on iphone4s(IOS7), but on iphone6(IOS8.1) the UILabel will first appear on the lower right corner plus a "BottomBar height" about 1 second then will update to the correct place (BottomSpaceToBottomLayoutGuide = 20)

When I set the pushViewController animated to NO, UILabel will show on the correct place immediately.

[self.navigationController pushViewController:vc2 animated:NO];

Anyone encounter the same issue?


Solution

  • I've solve this issue. Select bottom of the BottomSpaceToBottomLayoutGuide Constraint.

    enter image description here