Show navigation bar in swrevealviewcontroller - ios

I am using SWRevealViewController for side menu in my app. While choose one of the menu navigationbar hides automatically. I want to show the navigation bar always. I have tried following codes in my ViewController's viewDidLoad().
self.revealViewController().navigationController?.navigationBarHidden = false
and
self.navigationController?.navigationBarHidden = false
But both are not working.
I have followed https://www.youtube.com/watch?v=8EFfPT3UeWs to implement SWRevealViewController in swift based app.

Please Add a navigation controller between your sw_front navigation controller and view controller and hide the navigation bar of first navigation controller using attribute inspector.
To add navigation controller you need to select view controller and go to
Editor -> Embed In ->Navigation Controller

Your Menu (rear)VC can control this if you have it there then it always there unless you hide.

Related

How to use custom NavigationBar in ios TabBarController

I'm using a TabController which has a Navigation Controller as it's root and all works fine thus far except i would like to show the NavigationBar of the child viewcontrollers within the tab bar but for now just the tabcontroller's Navigation Bar shows.
This is how the tab bar shows now. with It's NavBar
This is the Navbar of the child ViewController I want to show
Embed a UINavigationController for each tab bar item rather than a UIViewController. You can then make the root view controller of each UINavigationController point to the view controller you want to use for that tab.
This allows each tab to have its own navigation bar and navigation stack.
EDIT
Also, if you intend on keeping your current navigation controller as the initial view controller, make sure you hide it's navigation bar by unselecting "Shows Navigation Bar" in interface builder
or by setting it in UITabBarController:
self.navigationController?navigationBar.isHidden = true
or by setting it in UINavigationController:
self.navigationBar.isHidden = true

Navigation controller back button doesnt appear?

I'm trying to setup back button on the navigation controller but it doesn't appear when I run it. I watched some tutorials and it usually works.
Your flow should be:
NavigationController --> MainVC --> FoodVC
Now you can add button as follow:
Navigation Item -> Left Bar Button Items -> Bar Button Item -> back button
Go to navigation controller scene -> navigation controller ->navigation bar - then go to right top show attributes option and change bar tint color.Try it
The view controller food is embedded in Navigation Controller , hence it is root view controller.
Navigation bar will appear when any viewController is push on same navigation controller.
So, If you tableview is already in Navigationcontroller then remove Navigation Controller in which Your FoodVC Controller is embedded.
If you want that navigation controller, you may add leftBarButtonItem programatically.
Totally depends on your requirement.
Is MenuVc your main Controller? try this, delete that navigation controller in the middle. Then click the MenuVc, embed in Navigation Controller and set the navigation controller as initial view controller at the attribute inspector. then navigate the menuVC to Food, "Show".

Tab Bar Item disappears after adding Navigation Controller

First I created a VC with TabBarController like this.
The other tabs and the main controller are at other storyboards.
Then, I added the Navigation Controller from the Editor > Embed In > Navigation Controller.
And the TabBarItem immediately disappears.
How can I change my tab bar icons and names?
In your storyboard you can change the tab icon from the Navigation controller. (Provided you have different navigation controllers for different tabs of your tab bar controller). YOUR NC will look something like this. (NC -> VC)
I checked your attach images. There are no issue with your navigation controller it will work fine with your tab bar.

swift xcode proper way to switch from navigation controller to tab bar controller

I have embedded a navigation controller like this:
I have also set this to be my root view with the arrow in storyboard pointing to this. But now I want to change so my app use a tab bar instead of a navigation controller. I have tried to click on the navigation controller than add a tab bar controller. But when I search through my storyboard xml file I still see refrences to navigation controller
To replace the NavigationController with a TabBarController:
Select the NavigationController in the Storyboard.
Hit the delete key.
Select your ViewController.
Select Editor->Embed in->Tab Bar Controller from the menu.
Select the TabBarController and check Is Initial View Controller in the Attributes Inspector.

Navigation bar button unresponsive in child view controller of UITabBarController

I instantiate my UITabBarController by calling navigationController.viewControllers = #[[self.storyboard instantiateViewControllerWithIdentifier:#"tabController"]];
My Tab bar controller has a child view that is embedded in a navigation controller. However the bar button (item) is unresponsive when I touch them (the buttons in the navigation bar). I have tried logging the action but it appears as if the button is not firing at all.
The only thing that I have done differently is the way i instantiated the tab bar controller. Am I missing something?
I connected the navigation bar button from the storyboard to an action so it is hooked up successfully. Please note there is also a navigation Controller pointing to the UITabbarController not shown below.
The unwanted behaviour maybe because this flow (navigation controller to tabbar controller) is ill advised in the Apple HIG. More information can be found here: Storyboard with NavigationController and TabController. The solution I found was to hide the navigation bar on the navigation controller that links to the navigation bar (can be done in interface builder), then make it reappear in the new navigation controller that the tab bar links to. Confusing I know, I can help anyone who ever has a similar issue.
Is there any specific reason you are doing this:
navigationController.viewControllers = #[[self.storyboard instantiateViewControllerWithIdentifier:#"tabController"]];
You can simply drag an outlet from the UITableViewController to the UINavigationController using only the Storyboard.
I think you forgot to add the navigationItem. In the storyboard, add a navigation Item to your viewController and move your bar button items to the navigation bar that appears on the top.

Resources