How to Modify an Existing iOS App to Support Split View - ios

I have an existing iOS app with a Navigation Controller (root view) that is set up as the initial view controller. In the storyboard, it has a Relationship "root view controller" to "my app". "My App" is a View Controller that has a Table View within the view.
I would like to make the initial view controller be a Split View Controller. When I drag a Split View Controller into my storyboard, it gives me a Split View Controller, a Navigation Controller, a View Controller, and a Table View Controller.
What I tried to do is connect my app into this model. First, I deleted the Table View Controller that came with the Split View Controller. Then I deleted my original Navigation Controller. Then I connected the new Navigation Controller to "my app" to create a Relationship "root view controller" to "my app". Finally, I made the Split View Controller be the initial view controller.
When I compiled and ran the app in the simulator, my app delegate (application:(UIApplication *)application didFinishLaunchingWithOptions) runs, but nothing else (i.e. I end up with a black screen). What else do I need to do to connect my app to this model for it to operate as a Split View?

Related

Relationship among split view controller, tab bar controller, and multiple tableview controllers

In my universal app with a split view controller at the top of the hierarchy, I want a tab bar controller with multiple table view controllers as the tabs. What should the storyboard and relationships look like?
I started with the default empty universal master/detail project. I got the standard split view controller with two navigation controllers pointing to the master table view controller and detail view controller. If I embed that master table view controller in a tab bar controller, that table view controller's detail view (actually, the detail view's navigation controller) remains the split view controller's detail view. When I add another table view controller and make it a tab of the tab bar controller, how to I hook that table view and its detail view to the split view controller? Whew.
Thanks!
...R
If I understand your desired structure properly, the graphic below should illustrate the relationships you want. (Direct Link to Full-Res Image: http://cl.ly/image/0S3y3V3O0930/Screen%20Shot%202015-05-21%20at%202.28.29%20PM.png)

In iOS is the Initial View Controller always the same as the Root View Controller

In the 'Start Developing iOS Apps Today' guide by Apple it says that, "the first item added to the [navigation] stack is the Root View Controller and is never popped off the stack." Later on in the same section it goes on to say, "one of the view controllers is marked as the Initial View Controller ... this is the view controller that will be displayed the first time the app is launched."
My question is are the Initial View Controller and the Root View Controller always the same thing or can they be different? For example, if you created a game where the Root View Controller was the view where you played the game could you have a different controller (maybe the start screen) be the Initial View Controller, and how would this work?
For example, if you created a game where the Root View Controller was
the view where you played the game could you have a different
controller (maybe the start screen) be the Initial View Controller,
and how would this work?
Let's say for the sake of argument that the game uses a navigation controller to manage its various view controllers. In that case, the nav controller would likely be the initial view controller as well as the window's root view controller. The game board view controller might then be the nav controller's root view controller.
If you wanted to show a "game start" view controller at the beginning of the game, there are at least three reasonable options:
Make the game start view controller the nav controller's root and push the game board controller onto the nav stack when the user starts the game.
Present the game start view controller modally, and dismiss it when the user wants to start the game.
Make the game start view controller the initial view controller (and the window's root view controller), and then present the navigation controller (with the game board view controller as it's root) modally.
So no, the "initial" view controller doesn't need to be the view controller that the user actually sees first, it's just the one that's loaded first from the storyboard. It may contain other view controllers, or it might cause some other view controller to be presented immediately.
There are two root view controllers in play here:
Your application's key UIWindow's rootViewController. (Most apps only have one UIWindow but some have more than one.)
A UINavigationController's root view controller (the first object in its viewControllers array).
The Initial View Controller in a storyboard will typically be set as your key window's root view controller (#1), although this too has exceptions.
If that happens to be a navigation controller (this is common), then that navigation controller will have its own root view controller (#2).
The initial view controller is associated with the storyboard which does the work for you in terms of making that the root view controller of the window.
You can have further root view controllers inside your application but these are secondary and separate to the window's root view controller.

Single View Template add navigation

So I started out an app by selecting the single view application template. I have added some more views using storyboard and everything was working good but I now wanted a button to take the user back to the first view using [ self.navigationController popToRootViewControllerAnimated:NO]; but the issue being the template started out as just a viewController. Is there a way to turn the first view into a navigation or root view to make this work or do I have to start all over in a page application template??
Insert a navigation controller in your storyboard before your root view controller.
Set the navigation controller as your initial view controller.
Set the navigation controller's root view controller to what was originally your first view controller.

popover UISplitViewController

I'm new to iPad App development (not to iPhone Development). I wish to show a split view controller as a popover when a particular button is clicked [Everything's in interface builder]. So I drag and dropped a Split View Controller and then made a segue from the button to the split view controller. I have set the size of Split View Controller as Form Sheet. Now in the iPad simulator I expect the popover to have both Master View Controller and Detail View Controller, however only the rootViewController (Master) is appearing and there is no scrolling too (in the popover).
How can I show both the master and detail view controller in my popover.
You should not try to do that:
A split view controller must always be the root of any interface you
create. In other words, you must always install the view from a
UISplitViewController object as the root view of your application’s
window.
You can read more about it here

Showing a UISplitViewController inside a pop over

I'm wanting to create a UI where I have a popover that comes from a button that and contains a split view UI with two table view controllers side by side.
The storyboard I have now has a normal page with a button, the button has a popover segue to a split view controller.
The split view controller has a master relationship to a navigation controller which has a root view controller of a table view controller.
The split view controller has a detail view controller to another navigation controller which again has a root view controller of a table view controller.
When I launch the pop up it only ever displays the master controller, not the two side by side.
UISplitViewCpntroller can only be the root view of an app - as such, you cannot put them in a UIPopover or any other non-root view.
You would have to create your own UISplitViewCpntroller type view (or look for some open source code).

Resources