popover UISplitViewController - ios

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

Related

How to Modify an Existing iOS App to Support Split View

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?

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.

UISplitViewController and Modal view controller presentation issues

I am having troubles with an application where I have a split view controller and would like to display a modal view controller over the top.
To test this, I have created a basic project which mimics the structure of my application. I have uploaded this to Github for anyone to download: https://github.com/CaptainRedmuff/SplitViewDemo
There are two main issues which I will detail below:
Issue 1:
When presenting the modal view controller in portrait orientation with the master view controller visible (as a popover I believe), the modal view controller is displayed underneath the master view controller. Any attempts to interact with the model view controller cause the app to crash.
Issue 2:
When presenting the modal view controller from the tab bar controller (in the master view controller), the modal view controller is automatically dismissed when the device is rotated to landscape orientation as the master view controller is removed from the hierarchy.
One possible fix I have found is to conform to the UISplitViewControllerDelegate method - (BOOL)splitViewController:shouldHideViewController:inOrientation: and return NO to force the master view controller to always be visible. This is not the behaviour that I want however so this is not a viable fix.
Considering that there is no way to programatically display or dismiss the master view controller, I am at a loss for alternative methods to present a view controller modally over the top of the entire split view controller.
Before presenting modal VC you must dismiss popover like:
[self.popover dismissPopoverAnimated:NO];
The issue occurred probably because UIPopoverController is added to the window instead of UISplitViewController.

Master-Detail with UITabBarItem?

Can you embed a Split-View Controller in a UITabBarController? I have a UITabBarController in my appdelegate on the window, and I tried adding a segue to my split view controller, but when I press the correlating tab for the DetailViewController it just shows a blank screen? Is it possible to even have a split-view controller as a tab in a tabbarcontroller?
A UISplitViewController must be at the root of your controller hierarchy. From Apple's Split View Controllers documentation:
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. The panes of your split view interface may then contain
navigation controllers, tab bar controllers, or any other type of view
controller you need to implement your interface. Split view
controllers cannot be presented modally

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