I am unable to enable back button on HomeViewController and MapViewController. I do have a Splash Screen before TabBarContoller which is the initial ViewController. Everything is working fine except the back button on HomeViewController and MapViewController. Please help me to fix this issue.
You can't show back button on your rootViewcontroller of NavigationController.
Here map or home are rootViewControllers for your navigation controllers so you can't see back button on that controller. If you will push anothe viewcontroller on that I mean on map or home then on that controller you will find back button.
And if your home or map Viewcontroller have back button and after clicking on that on which viewcontroller you will go?
So it is normal behaviour according to your screenshot shows in question.
Related
I am new in iOS development and in Swift. I have a question. I added in one of the ViewController NavigationController. But I have some problems with back button cause it doesn't appear on other Views. I tried with self.pushViewController() and with self.present() but it doesn't work. If I mark in NavigationController Is Initial View Controller then everything is fine but I don't want it because then app starts with this screen(where I have NavigationController).
Please help me, what I should to add or to write?
This is an image of my storyboard
And this is what I have if I run and go to another ViewController, as you can see I don't have navigation bar and back button.
You got 2 options :
1) Add a navigation controller in the root ViewController, Hide throughout except the last one. Make sure you push the last VC so Back option will be there by default
self.navigationController.pushToViewController(BarCodeViewController)
2) Use a custom View on top of last viewController add a custom button to that view. But this time present it from previous ViewController
self.present(BarCodeViewController)
when back button clicked dismiss it by adding target to the button. self.dismiss()
I have implemented a right item button in the navigation bar. I use the storyboard, no code. But now the back button is not displayed. What's the good way to show it again without boilerplate code ?
Thank you!
You can not see the back button on the rootViewController of the NavigationController
NavigationController automatically add the back button once you push some other ViewController to it.
It will display if you have not hides it explicitly.
If you have drag and drop the BarButtonItem as shown in the attached image, Just run the code and back button will automatically get added if it was not your RootViewController.
If it is RootViewController as displayed in images, try to push some ViewController on it, you will get the back button added.
If you add the left bar button item from Interface Builder, you will not get the back button displayed. Then you have to do it manually
I wish to simply add a back button to the view controller, when accessed from a TableView in my app.
I have embedded the resulting ViewController within the navigation controller, and the back button is simply supposed to appear as documentation notes, but it does not...
Remove the UINavigationController between FriendsViewController and IndividualChatController.
When you push a new navigationController, it creates a new navigation stack with its own navigationBar and therefore you don't see a back button in the navigationBar
I have a NavigationController embedded within a TableViewController:
My Issue I am having is I can't get the back button to appear in my app :(
Is there a step I am missing here ?
Back button appears only after you push a ViewController over another one.
In this image you only set the RootViewController of your NavigationController so you have nowhere to go back so that's why back button does not appear.
You can still put programatically a button that does what you need.
This is my first time using story board and I've set up like 5 view controllers with UINavigationController with buttons that push to the next view controller..
So I start on VC1 and push to VC2, then click and button and push to VC3, then click a button and push to VC4, and so on... on the last screen (VC5) I have a "home" button that the user can click to go back to the home screen (VC1), I've set it up so it pushes to VC1, the problem is when the user clicks that they are taken to the homescreen but then there is a back button on the navigation bar and they can go back to the last screen? After they click home they should not be able to return to previous screens without navigating through to them like they had the first time!
How can I accomplish this? Thanks! I'm used to working with xib and programmatically controlling the UINavigationControllers so this StoryBoard stuff is very new to me haha!
It sounds like you want an unwind segue. On the VC1 .m file add the following blank method:
- (IBAction)unwindToVC1:(UIStoryboardSegue*)sender
{
}
Then in your storyboard on VC5 Ctrl-drag from your home button to the green Exit button at the bottom of your view controller. Choose the unwindToMainMenu option and it should now go back to the VC1 when pressed and no longer have the back button as it has popped all the view controllers.
I think the method you're looking for is popToRootViewControllerAnimated:
[self.navigationController popToRootViewControllerAnimated:YES];