3 Replies
      Latest reply on Jan 24, 2020 7:18 PM by dschlabach
      Appsolute Level 1 Level 1 (0 points)

        I have this app which uses 2 UISplitViewControllers on 1 screen (landscape mode). All is working fine on iOS 12, but on iOS 13 the screen is wrong on 9,7 iPads, perfect on the bigger iPads.

         

        I have made some sample code to explain. All code, no storyboard stuff. All in AppDelegate.m :

         

        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

         

            UIViewController *right = [[UIViewController alloc] init];

            right.view.backgroundColor = [UIColor blueColor];

         

            UIViewController *middle = [[UIViewController alloc] init];

            middle.view.backgroundColor = [UIColor greenColor];

         

            UIViewController *left = [[UIViewController alloc] init];

            left.view.backgroundColor = [UIColor yellowColor];

         

            UISplitViewController* rightSplitViewController = [[UISplitViewController alloc] init];

            rightSplitViewController.viewControllers = [NSArray arrayWithObjects:middle, right, nil];

         

            UISplitViewController* splitViewController = [[UISplitViewController alloc] init];

            splitViewController.viewControllers = [NSArray arrayWithObjects:left, rightSplitViewController, nil];

         

            self.window.rootViewController = splitViewController;

         

            return YES;

        }

         

        I create 3 UIViewControllers, give them a different background color. I create 2 UISplitControllers and fill it with the UIViewControllers. Normally you should have your screen with 3 columns, in 3 colors, but on the 9,7 inch iPads you only get 2 columns.

         

        This is how it looks on the iPad Pro 11 inch and 12,9 inch : http://www.waiterone.net/11-inch.png

        This is how it looks on the iPad Pro 9,7 inch and the iPad Air : http://www.waiterone.net/9.7-inch.png

         

        What is going on? Bug in iOS 13? How can I solve this?

        • Re: Bug in UISplitViewController?
          KMT Level 9 Level 9 (15,485 points)

               >I have this app which uses 2 UISplitViewControllers on 1 screen

           

          On iOS 13.x, I would use something along these lines, instead (clipped from the beta release notes/SwiftUI/New Features):

           

          • You can style a NavigationView using two new style properties: StackNavigationViewStyle and DoubleColumnNavigationViewStyle. By default, navigation views on iPhone and Apple TV visually reflect a navigation stack, while on iPad and Mac, a split-view styled navigation view displays. (51636729)When using the DoubleColumnNavigationViewStyle style, you can provide two views when creating a navigation view — the first is the master and the second is the detail. For example:
          • Re: Bug in UISplitViewController?
            hacknicity Level 3 Level 3 (130 points)

            It looks like the second split view controller is collapsing to its detail view (right = blue) so you don't see its master (middle = green). Perhaps the logic where iOS decides whether it has enough horizontal space to show both master and detail has changed? The 9.7" iPad allocates 320 and 704 points to the master+detail (in landscape). The 10.5" iPad allocates 320 and 792. The 11" iPad allocates 375 and 818. The 12.9" iPad allocates 375 and 990. I don't think those sizes have changed between iOS 12 and 13, but the decision on whether to show master+detail might have changed.

             

            If this is what's happening you might be able to set the perferredDisplayMode on the right split view controller to UISplitViewControllerDisplayModeAllVisible to try and force both master and detail to be visible.

              • Re: Bug in UISplitViewController?
                dschlabach Level 1 Level 1 (0 points)

                I would just like to come here and say thank you! We have... at least for our company and customers... a high profile app that's used twice a year for a week at a time. The above propose rewrite just would not be possible in the time left. When I checked the app post iOS 13 I did iPhone and a large iPad Pro as that was what was sitting arround. Imagine my shock when with two weeks left I load it up on my personal Mini and it doesn't work! My fault but you'd really expected them to work similar. Anyway your comment was the golden ticket until post event I can rewrite.

                 

                 

                -(UIViewController *)from:(UIStoryboard *)storyboard getVC:(NSString *)name{

                    UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:name];

                  

                    // Deal with iOS 13 change and smaller iPads.

                    if([vc isKindOfClass:[UISplitViewController class]]){

                        ((UISplitViewController *)vc).preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;

                    }

                  

                    vc.tabBarItem = [self createMenuItem:name];

                    return vc;

                }

                 

                Again, a big thanks you!