0
votes

I have a navigation controller where I have enabled hide on tap.It hides at first when I tap on the screen but when I tap again,the nav bar hides but the toolbar does not hide at all and it is obstructing my view. I have already tried settoolbarhidden and toolbar.hidden properties but it does not work.How do I solve this?

enter image description here

EDIT : I need to hide it only on this screen,I need the toolbar for other screens so thats why I have enabled shows toolbar.

EDIT 2 : Let me frame my question better.

When I enter the view controller :

enter image description here

Both navbar and toolbar hides because I have set it to hidden which is good

When I tap the screen :

enter image description here

Both navbar and toolbar shows because I have set it this way in the previous view controller.(If possible,Can I only show/hide the navigationbar on tap not the toolbar?

And lastly when I tap it again to hide both bars :

enter image description here

The navigation bar hides but the toolbar does not go away? This is my problem.

2
try [self.navigationController setToolbarHidden:YES animated:YES];Anbu.Karthik
Have tried setToolbarHidden but still does not work.Please refer to my updated question.Syed Ariff

2 Answers

2
votes

As Per your question you want to show tool bar on a particular viewController. View Controller viewWillAppear Function Hide ToolBar and viewDidDisappear show your tool bar it will show on other view controllers.

" Please check the navigation controller checkbox its disable or not.After that set this on your view controller before your profile view controller "

override func viewWillAppear(animated: Bool) {
    self.navigationController?.toolbarHidden = true;
}
override func viewDidDisappear(animated: Bool) {
    self.navigationController?.toolbarHidden = false;
}

I think it will resolve your issue.

0
votes

I had the same problem.

The hideBarsOnTap only work if you placed smth in it. So if it is empty it will stay.

You could just put a blank imageView or Label there for example.

Or if you want it completely blank, your only option is to put a tabGestureRecognizer on your View!