I’ve been fighting for this for some time, but I couldn’t find a solution:
I have an iOS 9 application that supports all device families, uses size classes, and is programmed with Swift 2.0. I use UISplitViewController
, and everything works the way I want, except for a minimized environment (for example, on the iPhone).
The Master-ViewController is the UITableViewController
one that triggers the replacement of segue when selecting a cell. In a minimized environment, this means that the detailViewcontroller element hits the screen. UISplitViewController
visually behaves like a UINavigationController
. However, when I reject the detailViewController using the back or gesture button, it is not released until the new segue shift in the Master-ViewController is canceled.
I suppose this is a kind of function UISplitViewController
since it was originally designed to display both contents side by side. However, in a folded environment, I would like mine UISplitViewController
to behave as a simple UINavigationController
one that releases the previously thrown detailviewController when it appears.
I try to manually change the splitViewController attribute viewControllers
after the detailViewController element appears:
if let firstVc = self.splitViewController?.viewControllers.first {
self.splitViewController?.viewControllers = [firstVc]
}
But that does not help. Simply replacing detailViewController with an empty "Dummy" -ViewController does not work either, since it automatically enlivens the transition. Playing with UISplitViewControllerDelegate
didn't help me ...
Is there a solution for this (maybe just? :)) that I'm too blind to see?