I'm working on an universal iOS app and I'm using SplitViewController. I have been trying to disable the splitView on iPhone 6+ and 6s+ in landscape mode but nothing seems to work. I attempted to override the UITraitCollection by setting its horizontalSizeClass to Compact, it doesn't seem to work either. Has anyone attempted this? Below is my code to override UITraitCollection
override func overrideTraitCollectionForChildViewController(childViewController: UIViewController) -> UITraitCollection? {
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
let collections = [UITraitCollection(horizontalSizeClass: .Compact), UITraitCollection(verticalSizeClass: .Compact) ]
return UITraitCollection(traitsFromCollections: collections)
}else {
return super.traitCollection
}
}
I have this in my viewDidLoad of the splitViewController.