NavigationController inside TabBarController, or vice versa? - ios

I apologize if this is simple or answered elsewhere, but I can't seem to find it.
I'm building a tabbed app in which some (but not all) tab views need navigation. Should I:
1) Use a UITabBarController root controller in which the navigation subviews are themselves UINavigationController instances.
2) Use a UINavigationController root controller, containing a TabBar instance, and hide the bar navigation when on a tab that doesn't need navigation services.
3) A totally different architecture.
?

If I understand your choices, you want to do #1. The view controllers that are connected to the tabs can be navigation controllers. In a storyboard, you can start with the tabbed application template, and delete the view controller that's given to you by default, drag in a UINavigationController, and reconnect it to the tabBarController with a relationship segue.

Related

SWRevealViewController switching between ViewControllers

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

Can I have a SplitViewController inside a TabBarViewController(iOS 9.0 +)?

I have an app with UITabBarViewController as rootviewcontroller. On some tab item, I want to have a SplitViewController inside a UITabbarViewController.
So here my UISplitViewController will become a childViewController for TabbarVC.
Will this be allowed? Are there any Apple guidelines suggesting not to do this?
As I see, they are suggesting to put SplitVC as RootVC. But many applications have already done what we are doing now.
Answers here might help Apple recommends UISplitViewController should always be the rootviewcontroller
I had nearly same scenario of creating a UISplitViewController inside a view controller. So I created my own custom SplitViewController
Here is the note from apple
You cannot push a split view controller onto a navigation stack. Although it is possible to install a split view controller as a child in some other container view controllers, doing is not recommended in most cases. Split view controllers are normally installed at the root of your app’s window.
Apple HIG recommends to have tab bar as the root or split view controller as root. But I still achieved this by putting in a container for one of the tab bar's child view controller. And as a result, you can load split view controller into the container view of any view controller, irrespective of whether its tab bar or a normal view controller.

Have a NavigationController within a TabBarController Item

I've looked around and been unable to find a clear example/explanation of how to do this. I've just started with swift, apologies if any terminology is off.
What I'm looking to do is add a NavigationController to one of my TabBarItems in a way that I can view multiple views from utilizing the NavigationController while still staying within that TabBarItem view
So far I have the TabBar created, with three items. I don't mind doing it in either storyboard or programatically.
In the storyboard give each page view controller it's own navigation controller and make the navigation controllers the view controllers pointed to by the tab bar controller.
Do it like so:
https://stackoverflow.com/a/26153273/1527064

Use of differenct view controllers

i'm curious about what's the best way to plan the controllers for my app.
i want my main screen to have 3 button.
1) should open a nav controller with details view
2) should open a controller with other buttons that lead to others controllers
3) should open a tab bar with 2 pages ( or eventually use a switch to change page instead of the tab bar)
this is the schema of what i want
http://i59.tinypic.com/2rrvrd4.png
Is it a correct schema or i should use my controllers differently? will apple reject an apple with such schema?
thanks
As #Fogmeister pointed out in the comments, going for a UITabBarController as the main interface for your app actually seems to be a more appropriate solution here.
However, you can go with the interface that you described, but then you should keep in mind that with your current setup, you are not only using UINavigationController in the first case, but your whole navigation system is still built upon UINavigationController in the following way:
Your app has one instance of UINavigationController.
Your initial UIViewController (the one with the three buttons), is the rootViewController of your UINavigationController.
You can navigate to the other view controllers using [self.navigationController pushViewController:newViewController] (or performSegue if you prefer using Storyboards).
In the case of your third view controller, you are pushing a UITabBarController onto the navigation controller's view controller stack, this UITabBarController needs to be initialized with the two view controllers that it is going to display before it gets pushed onto the stack.

iPhone UITabBarController inside of UINavigationController?

Are there any good example of a UITabBarController inside of a UINavigationController? I have been googling it, but all I can find is the opposite (one navigation controller for each tab bar). I have two tabs and I want either to be able to control the overall navigation.
Never mind, I found a similar question here:
Tab bar controller inside a navigation controller, or sharing a navigation root view

Resources