Using UITabBarController with UINavigationController - Swift 3 - ios

I am making an app which requires a use of a UITabBarController along with UINavigationController. I have made the following flow in storyboard.
See image
Now the first question is that is this accepted by Apple, as there are too many discussions for the same.
The other matter of concern is that is it possible to eliminate any UINavigationController and still get the same flow of the app? The main thing required is to have the SAME tab bar and navigation bar on all sub tabs of the tabs. One point to be noted is that if I remove the second UINavigationController then my app navigates directly from sub tab to home view controller on clicking back button.
I have been stuck on this since hours now. I am new to iOS app development and have never uploaded any app to the app store. Any help would greatly valued.
EDIT :
I put the second navigation controller as shown in the answers - see this flow, But because I have a navigation controller before the HomeViewController, so I am getting a navigation bar at the top and then some empty space below that(exactly equal to the top navigation bar) and then the page contents on runtime. Any solution to this?

Yes, it is acceptable by Apple.
But View hierarchy is not managed correctly. In your case Tab bar will be the root view controller for 2nd navigation controller.
Also, Tab and sub tab you are pushing will be part of 2nd navigation controller.
That's the reason you are getting back on Home view controller.
It's good practice to keep navigation controller to each Tab to manage it's sub-tab hierarchy.
You could present tab bar controller or setviewcontroller from Home View controller.

First embed tab bar controller as in this image and the embed navigation bar controller as in this image finally this will look like

Related

Changing tabs on Tab Based Application Pushes UI Elements Down

I have a tabbed based iOS application. The fourth tab is linked to a UINavigationController. When I navigate to the home tab from the fourth tab, the UI elements of the home tab are pushed down. However, if I rotate the phone to landscape and then back to portrait, everything has moved up and is in the correct place.
In Storyboard, I set the top bar to none. I have the UINavigationBar hidden in the fourth tab/view controller before I navigate to the home tab.
Why would it be that the rotation fixes the constraints? How can I fix the UI elements such that they are not pushed down in the first place?
Here is a screen shot of my storyboard:
Your question doesn't really make sense. A 4th tab would not be embedded in a navigation controller. Instead, the 4th tab would link to a navigation controller. When you first select that tab you'd see the root view controller and it's navigation bar item. If you pushed a new view controller it would get pushed onto the navigation controller in tab 4. If you switch to one of the other tabs then the navigation controller will be swapped away and it's navigation bar will no longer be visible. Swap back to tab 4 you'll see it again, complete with it's navigation bar.
I created a sample app in order to confirm what I'm describing, as I haven't used tab bar controllers a lot, and not in quite a while I can upload the project if you really need to see it. It only contains a couple of lines of code (to implement the button on the navigation controller's view controller that creates and pushes a new view controller.)

What type of view controller is used for this app?

Does anybody know what kind of view controller this app uses? I am trying to implement one somewhat like this but can not get the tab bar to appear at the bottom when I use the table view controller. I also can not get the title of the view to appear at the top where it says home.
I would say this is a tab bar controller. The home tab you show may just have a navigation bar placed on top of it as a sub view or it is embedded into a navigation controller.
My image shows a tab bar controller as the root controller and initial controller and the view from the first tab embedded in a navigation controller.
Hope this helps!
The screen you are looking at is a combination of a UItabBarController a UINavigationController and a UITableViewController.

Using UITableViewController in a navigation bar

I'm new to iOS, but I know the basis. I want to host 3 UITableViewController in a UITabBarController using the storyboard.
I dragged a UITableViewController from the object list(?) and control dragged creating a seguel. Now the tab shows successfully the table view controller.
The issue is the rows are taking the space of the status bar. So I want a navigation bar(?) there, with a title. Since I'm new to iOS I don't know the following:
Given the fact that UITabBarController is the first controller ever, the hosted UITableViewController should not have a back button, obviously. So is it correct to use a navigation bar to display a title (and possible add/edit buttons)
If so, I tried dragging the Navigation Bar but it doesn't work.
What am I missing or doing wrong?
hope this helps
actually it is done for another answer. but it will be handy to u too
You will want to add in 3 UINavigationControllers. Have each tab in the tab bar controller segue to a different navigation controller. Then set the root view controller for each navigation controller to one of the table view controllers.

Corrupted UINavigationController with embedded UITabBarController

My app is based around a UINavigationController. On some screens I have a UITabBarController embedded within. When I go to a screen with the tab bar everything works fine on the first tab. (each tab is a UITableViewController) I can tap a cell of the table view and it'll take me to the next page by correctly pushing it onto my nav controller. If I go to another tab it loads the table view fine, but if I tap a cell to take me to another view I get this error:
Nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
It pushes on the next page, but then if I attempt to press the back button on the nav bar the app will crash.
How could I go about fixing this? I looked at multiple other responses to similar problems, but none of them have helped me with this.
It would be really helpful if you share your code.
However this may be helpful for you:
while using tab bar , you should try that every single tab has its own navigation controller and use individual navigation controller to move to specific viewcontrller of specific tab. I know its hard to understand like this..
For e.g in app del you have your main navigation controller using which you push to next view controller ,say "SecondViewController".
Now this second one has got one tab bar with 4 tabs tab1,tab2,tab3,tab4. now each tab can have any no of view controllers associated with them. For e.g on tab1,you move to another screen and again from there to next screen and so on.
So to manage them there should be separate navigation controllers like,tab1nav,tab2nav,tab3nav,tab4nav.
tabBarController.viewControllers = [NSArray arrayWithObjects:"tab1nav".....and so on all nav, nil];
Now depending in which tab you are, use that tab's navigation controller to move to next screen of that tab or move back.
If you have viewDidAppear function,
Remember to put [super viewDidAppear:animated]; inside the function.

ios - UITabViewController working, but now my other segueys stopped working

I enabled o UITabView on the bottom of the screen, and that works, but the rest of my buttons on the app screen suddenly stopped working. Would anyone know why that might happen? I was using push segueys for them.
I think the issue may be that originally I have a NavigationController that I use on the app, and then the UITabBar controller interferes with it.
Thanks!
As per Apple recommendation, UITabBarController should only be the root controller of an app. I think what you are doing is you are having the UITabBarController nested in your UINavigationController, and that won't work.
You can instead select your navigation controller and embed it in a UITabBarController. (I don't have XCode with me now, but I think there's an option in the menu called Embed in -> Tab Bar Controller. You can search for it in Help.)
(If you need the tab bar controller to be nested under nav controller, I believe you need to use some buttons to fake its effect.)
If you only need a tab bar but not tabbar controller, then don't use tabbar controller.

Resources