0
votes

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
did you checked require full screen.? - MRizwan33
no, what's that? - Daniele B
It's because horizontal size class of iPhone 6 Plus in landscape is Regular, not Compact. What mode do you set to preferredDisplayMode? - snak
I didn't set this property, so it defaults to automatic. - Daniele B

1 Answers

0
votes

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.