iPhone Plus: why is UISplitViewController showing both controllers in landscape?

121 Views Asked by At

I am using a UISplitViewController with these values:

    splitViewController.preferredPrimaryColumnWidthFraction = 0.4
    splitViewController.minimumPrimaryColumnWidth = 320
    splitViewController.maximumPrimaryColumnWidth = 1000
  • On iPhone 6 in landscape, the UIViewController shows just 1 controller
  • On iPhone 6 Plus in landscape, the UIViewController shows both controllers

I can't understand why.

Given the screen sizes of both devices:

    iPhone 6:      375 x 667
    iPhone 6 Plus: 414 x 736

736 x 0.4 = 294.4, which is still smaller than 320

why it's then showing both controllers in landscape for iPhone Plus?

UPDATE:

It looks like preferredPrimaryColumnWidthFraction and minimumPrimaryColumnWidth have nothing to do with the threshold width that causes the split. They just define the width of the first controller, in case both controllers are shown.

I am now looking for a way to prevent the split on the iPhone Plus, so that it behaves the same as the iPhone non-Plus.

1

There are 1 best solutions below

15
MRizwan33 On

Please check that. Require Full Screen. below Status Bar Style. enter image description here

Another way:

first check your current mode on different devices.

- (void)splitViewController:(UISplitViewController *)splitViewController willChangeToDisplayMode:(UISplitViewControllerDisplayMode)displayMode {
  if (displayMode == UISplitViewControllerDisplayModePrimaryHidden) {
       NSLog(@"Detail view is visible");
} else if (displayMode == UISplitViewControllerDisplayModeAllVisible) {
       NSLog(@"both are visible");
  }
}

then set your require preferredMode.