I added a UITabBarController, then manually I added a navigation bar to the UITabBarController, so my UITabBarController looks like this:
Then I drag a segue from my UITabBarController to two UITableViewController.
My problem is that in my UITableViewController when I load data, the data comes behide the navigation bar, not under it.
What do I do wrong ?
Your view should be embed in navigation controller first then u embed that navigation controller with tabbar controller then it should work fine
Related
So, I have an hierarchy which is(see image for better understanding): Navigation Controller -> Tab Bar Controller -> VC1,2,3,4,5
All good, all working.
Now, if I segue from one those VCs I lose my Tab Bar. Which I believe it is weird, since they all have a connection to the Tab Bar Controller VC.
Any way I can maintain it?
Thanks
you should not add UITabBarController inside UINavigationController, but you should add each UIViewController managed by UITabBarController inside a UINavigationController
like the following image
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
I'm trying to display the navigation bar at the top of the screen, but it's not showing in embed navigation controller.
Here is how it is in the storyboard:
And here it's in the simulator:
As you can see, I created a custom TabBar (following this tutorial) at the bottom of the screen so I can navigate between the different views.
I believe that I'm going to have to load the navbar programatically because the only solution that I found was to set the navigation controller as the initial view controller, but I already set another view as the initial one so I can't do that.
Issue :
When you instantiate a viewController using storyBoard identifier they wont come with free embedded navigation controller, even if you have added a NavigationController to them. As a result you are adding a viewController without navigation bar to your tab bar VC.
Solutions:
Solution1: If you want each child viewControllers to carry their own navigation controller hence their own navigation stack, provide a storyboard identifier to Navigation Controller behind your child viewControllers and instantiate the Navigation controller itself rather than ViewController. And add NavigationController as you tab bar looking VC's child. Because navigation controller loads the embdedded VC by default you will see your child VC with nav bar.
Solution2: All that you care for is only nav bar than add the Navigation Controller behind the VC containing tab bar looking View.
Hope it helps
Have you tried constraining the navigation bar to your view? Otherwise it can move offscreen.
You need to point the tab bar controller segue to the navigation controller of your view - otherwise if you point the segue straight to the view you're just loading the view without any navigation controller attached.
I have a problem with SWRevealViewController. In my app I have a long chain of UIViewControllers connected to a single UINavigationController. After adding a side menu and setting the "reveal view controller push controller" segue for cells I see only ViewControllers connected with a segue. I can't move between my UIViewControllers in the chain any more. And navigation bar is missing. Is it possible to use a side bar and UINavigationBar at the same time?
I see your image I think you have to add another navigation controller before the C****** S****** View Controller or the view controller you want to go
the reason is that there is no UINavigationController before the C****** S****** View Controller and that's why Navigation bar is hidden and you can't move
I want to add UITabBarController as root view of my UINavigation controller. The purpose of that is that I want to make similar navigation as Facebook app: Then user select contact on Contacts tab - pushed view with user details doesn't have TabBar.
So, I have navigation controller, tab bar as a root view or it and couple TableViewControllers inside this UITabBarController.
I have two major issues with that:
I can't assign title for navigation bar for root views of tabbar. If I open contact details I have navigation bar title and no tab bar (as I wanted). But if I select Contacts or Favorites - those views have empty navigation bar title. I've tried to set it on viewDidLoad and viewDidApper without any success
Even worse issue. When I press Favorites table view insets are broken. first cell is under navigation bar. First loaded tableview (in my case Contact) displayed correctly. Adjust scroll view insets is YES for both TableViews.
Update:
Solution storyboard (note property "Hide Bottom Bar on the Push" is switched to YES).
I was also struggling with UITabBarController + UINavigationController issue. When UITabBarController was contained by UINavigationController, content insets were acting really weird.
I would suggest to use navigation controllers inside UITabBarController and when next controller is pushed, set 'hidesBottomBarWhenPushed' on that controller to YES.
This would also solve setting navigation bar title, as navigation controller is closer to view controller. You can just use self.navigationItem.
If you leave it to current setup - UITabController contained within UINavigationController, then you need to modify navigationItem on controllers tabBarController (self.tabBarController.navigationItem). Note that best place for it would be in view controllers 'viewWillAppear' for every controller contained within UITabBarController, as they share one navigation item.