mapbox / ios-sdk-examples

Live example code for the Mapbox iOS SDK
https://www.mapbox.com/ios-sdk/examples/
Other
95 stars 35 forks source link

Split view on iPad doesn’t load anything initially #360

Open friedbunny opened 4 years ago

friedbunny commented 4 years ago

When launching the app on iPad, our UISplitViewController defaults to showing the child view controller (i.e., the map/example), but this view controller does not load anything until an example is tapped in the primary (menu table view) controller.

This means that UI tests aren’t able to start on iPad, because the elements it expects are not available.

We may need to fiddle with this property:

https://github.com/mapbox/ios-sdk-examples/blob/4dbe089786ef6b057954ffa72bec0b184b0c3ffb/Examples/ExamplesTableViewController.m#L47

Screenshots

Nothing loads initially

Screen Shot 2019-09-20 at 12 55 08 PM

Rotating the screen a few times brings up the primary controller

Screen Shot 2019-09-20 at 12 55 31 PM

/cc @captainbarbosa @julianrex @lloydsheng

tsuz commented 4 years ago

This seems to occur on iOS 13 on iPad where the viewDidLoad is too late (ref)... A workaround for me was to add:

-(void)awakeFromNib {
    [super awakeFromNib];
    // The menu and example view controllers are displayed side-by-side onscreen.
    self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;
}