How to embed a split view controller?

I have following requirement:


The main screen is a map with search field.


Tapping on the map the app is showing a callout.


Tapping on callout I want to show split view controller

with more info about location.


Looking at Safari it is doing something similar.

When tapping on the bookmark icon a split view controller

appears where I can select favorites, etc. In landscape

the primary view controller is on the left side, tapping

on favorite link I can see the page at right.

The way how the split view controller appears it looks

like embedded in presented view controller.


From documentation I am learning that split view controller

must be always a root view controller.


Embedding split view controller in custom view controller,

I suppose I can show this custom view controller in presented view controller

and dismiss it when needed to show the map in the background if needed.


How to achieve the same functionality as in Safari?

>From documentation I am learning that split view controller must be always a root view controller.


Exception is when a SVC is used in a TabBarController - see the docs.

Could you please point me to the link in the doc?

Yes, I got this from the forum too, but nothing in the documentation.


In Safari in horizonthally constrained (for example iPhone portrait)

I see tapping on the bookmark splitview is appearing embedded

in presented view controller.

That thread has my post that links to the docs. I'll repeat it here:


"See this doc on 'order of containment':

https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html "

Here is what I want to achieve:


=======================================================

Horizonthally compact - (for example iPhone Portrait) - as in Safari - tap on bookmark

=======================================================

root

|

map

|

button

|

presented view controller

|

split view controller, Done button at the top right

|

tap on Done button - hides the presented view controller, shows back the map


=======================================================

Horizonthally regular - (for example iPhone Landscape) - as in Safari - tap on bookmark

=======================================================

root

|

map

|

button

|

split view controller

|

Primary on the left, tap on the link - show details at right

|

tap on bookmark button - the map is showing back on full screen hiding the split view controller

with animation

>presented view controller

Seems a bit vague...you must know the type, no?

the new


UIPresentationController


And the docs say this about that:


"You vend your custom presentation controller object through your view controller’s transitioning delegate. UIKit maintains a reference to your presentation controller object while the presented view controller is onscreen. For information about the transitioning delegate and the objects it provides, see UIViewControllerTransitioningDelegate Protocol Reference."


Sorry if I missed it, what type is your root controller?

Now the question is - can I embed SVC in UIPresentationController?


My root controller is NavigationController, next is a ViewController

in its View is embedded a MapView.

According to the 'order of containment':


You can use the view controllers that the UIKit framework provides by themselves or in conjunction with other view controllers to create even more sophisticated interfaces. When combining view controllers, however, the order of containment is important; only certain arrangements are valid. The order of containment, from child to parent, is as follows:

  • Content view controllers, and container view controllers that have flexible bounds (such as the page view controller)
  • Navigation view controller
  • Tab bar controller
  • Split view controller

...your arrangment doesn't seem possible.

So you are saying Split view controller

should be first?

If it's first, then it's not embedded and ordering doesn't apply.

I made it first like this:


root is ContainerViewController
his first childViewController is SVC


So it is first and allowed.


But I want to show the map first and overlay

everhything else over the map. This is natural.

I successfully embedded SVC in UIPresentationController.

How to embed a split view controller?
 
 
Q