0

I want my app to go back to main root view controller on button click, but when i press the button it goes but the navigation bar is disappeared. I have tried different solutions but no luck.

10
  • 1
    tell us about the app, the navigation controller, if/when you're hiding/showing the navigation bar, what the view hierarchy is when things go wrong, any error messages or interesting log output - we need something to go on... Commented Aug 14, 2016 at 7:35
  • Hello Wain, Actually my app is WEAR PASSBOOK in which i need to make the navigation bar static in all the views and in my end View i have a button saying "add tickets" which also saves my data to database and at the same time it pops to root view controller to add the tickets again, but unfortunately when i pop to root view controller the navigation bar disappears... Commented Aug 14, 2016 at 8:30
  • hey Wain. my app hierarchy is splash screen -> root view page displaying button saying "add tickets" which opens photo library to select photos of tickets --> then the selected photo is displayed in another view where i have to crop the selected image and display the cropped image on another view where i also have a drop down menu and three text field stating select ticket category and then ticket type and the date and time and also have a button saying generate ..when i click on generate button it displays the inputted values on another view and in the last view i have a "add ticket" button Commented Aug 14, 2016 at 8:47
  • show the code for how you pop back. do all the views you show have a navigation bar then, until you pop? Commented Aug 14, 2016 at 9:23
  • @IBAction weak addTickets(sender: UIButton) { self.navigationcontroller?.popTorootViewController(true, animated: true)} Commented Aug 14, 2016 at 9:39

1 Answer 1

3

Try this: In your Root View Controller, add this code:

override func viewWillAppear(animated: Bool) {
    self.navigationController?.navigationBarHidden = false
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.