iOS 11 navigationBarHidden not working

in iOS 10 the navigation bar hides when I run [self.navigationController setNavigationBarHidden:YES];

Running on iOS 11 beta 9 it doesn't. Is there any known issues around this? All theories would be helpful.


Not sure it's related but I mention it just in case.

Selecting "Under top bars" in Storyboard makes my view appear under the navigationBar in iOS 10 as expected but not in iOS 11.

Update: Correction, actually in iOS 11 the content in the navigationbar is hiding when calling [self.navigationController setNavigationBarHidden:YES]; but the underlying viewcontroller view does not resize to take up the full screen. Therefore it looks like the navigationbar is visible.

In iOS 10 the same underlying view is auto resized to fill up the space where the navigationbar frame otherwize is located.

Hi,


did you figure out how to solve this issue? I have the same problem.


Thank you

Hi,


Are you able to solve this issue? I am also facing same problem.


Thank you

the solution that worked for me is


self.collectionView.contentInsetAdjustmentBehavior = .never

I'm also seeing this issue. On the iPhone 8 Plus simulator, everything works as it previously did. On the iPhone X simulator, the navigationbar is hidden, but a white bar shows in it's place instead of everything being "moved up" as if it wasn't there (which is the behavior on the iPhone 7).


I'm not really sure how to address this, or even if it can be addressed because it may be a bug. The UIView I've got doesn't have a collectionView (which another person in this thread used to get the desired behavior), just a couple of labels, a background image, and things like that.


Any idea how to fix this?

Was using viewDidLoad, but same issue and moved to seperate, willAppear and Disappear


-(void)viewWillAppear:(BOOL)animated{

[super viewWillAppear:animated];

[self.navigationController setNavigationBarHidden:YES animated:NO];

}

-(void)viewWillDisappear:(BOOL)animated{

[super viewWillDisappear:animated];

[self.navigationController setNavigationBarHidden:NO animated:NO];

}

-(void)viewDidLayoutSubviews {

[super viewDidLayoutSubviews];

[self.navigationController setNavigationBarHidden:YES animated:NO];

}

I'm experiencing this same thing and I'm not using the beta version. I'm using XCode 9.3 which is the latest non beta version.


I'm not using a UINavigationController, I have a UINavigationBar on it's own.


Anyways, I solved this by adjusting the top navigation bar constraint.



First you will need to create a property for the top bar constraint.


If you use interface builder you can simply drag the constraint onto your file and create an IBOutlet but if you use pure code you will need to add the property manually.



var topBarViewConstraint: NSLayoutConstraint?


// hide bar
topBarViewConstraint?.constant = -navigaitonBar.intrinsicContentSize.height

// unhide bar
topBarViewConstraint?.constant = 0



This is not ideal but it will get the job done.


You can even animate the constraints if you want.

iOS 11 navigationBarHidden not working
 
 
Q