简体   繁体   中英

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

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.

Please check that. Require Full Screen . below Status Bar Style. 在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM