3

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.

bachman
  • 690
  • 7
  • 22
  • Check this link : https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISplitViewController_class/index.html#//apple_ref/occ/instp/UISplitViewController/collapsed – Alessandro Ornano Jul 07 '16 at 14:42
  • what you mean by disable? – s1ddok Jul 07 '16 at 20:53
  • 1
    I'm trying to prevent splitViews from appearing on iPhones. Like how it happens to smaller iPhones like 6 and 5. I'm trying to show only the masterView on landscape orientation on bigger iPhones. – bachman Jul 07 '16 at 20:55

0 Answers0