UISplitViewController
in portrait on iPhone always show master and detail in iOS 8
I try to subclass UISplitViewCont
UISplitViewController use show side-by-side only in horizontally regular environment (new TraitCollection size)
The split view controller determines the arrangement of its child view controllers based on the available space. In a horizontally regular environment, the split view controller presents its view controllers side-by-side whenever possible. In a horizontally compact environment, the split view controller acts more like a navigation controller, displaying the primary view controller initially and pushing or popping the secondary view controller as needed. You can also ask the split view controller to prefer a specific arrangement by assigning a value to the preferredDisplayMode property.
Solution. You have to change TraitCollection of SplitViewController. How do this:
ViewController Wrapper
class TraitOverrideViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
configureSplitVC()
}
private func configureSplitVC() {
let splitVC = self.childViewControllers[0] as UISplitViewController
setOverrideTraitCollection(UITraitCollection(horizontalSizeClass: .Regular), forChildViewController: splitVC)
}
}
In iOS 8 UISplitViewController uses Adaptive User Interfaces and TraitCollections to show its content.
It shows different style depending on the size of and type of the view. You can change by technic I explain above.
You can get more info in WWDC video about Building Adaptive Apps with UIKit