Group Group Group Group Group Group Group Group Group

Adaptive Layout Tutorial in iOS 12: Getting Started | raywenderlich.com

#1

In this tutorial, you’ll learn how to use Adaptive Layout in Xcode 10 with iOS 12, enabling you to reuse the same storyboard for multiple devices and orientations.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1343912-adaptive-layout-tutorial-in-ios-12-getting-started
#3

I need to write an app that runs on iPad & iPhone.

The code for all the viewcontrollers and views functionality will be identical.

However, the iPad needs to use the ui container ViewController to display 6 UIViewControllers at once.

Obviously this is impossible on the iPhone so I’m resorting to a UIPageViewController on IPhone.

My question is this: given that the UIViewControllers for the 6 “screens’ are identical, is there a way to do this with adaptive layout and storyboards, or do I need to have two storyboards and duplicate all the UIViewController code for iPad and iPhone?

#4

@adamrush Can you please help with this when you get a chance? Thank you - much appreciated! :]

#5

Hello annemarie1185,

Sorry for the delay in responding :]

In complex situations like this, I would probably do most of this in the Storyboard and then in code swap out the UIPageViewController dependant on the size class. You could still re-use ViewControllers for both iPad & iPhone but in code swap the Paging vs. Container.

I hope this helps,
Adam