Hiding Navigation bar with self.navigationControll

2019-09-15 16:10发布

问题:

I have a UITableView object in my view controller and I added the following code inside viewDidAppear::

self.navigationController.hidesBarsOnSwipe = true

The navigation bar is hiding when I scroll up, but when I scroll down it's not coming back.

Do I need to do something else?

回答1:

By default storyboard add tableview top constraint to "Top Layout Guide.Bottom", you need to change the tableview.top constraint to "View.Top"



回答2:

check your constraints for tableview. It's top constraint should be pin with superview's top not with the toplayoutguide's top. I think you have set constraint with toplayoutguide. So, try to change it with superview's top and your issue will be solved.



回答3:

I think you need to uncheck Extended edges- under top bars to align your UITableView with topLayourGuide. Refer the attachment.