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?
Apple documentation seems to indicated that adaptive layout and size variations can’t handle this, so two separate storyboards seems to be the answer, but everywhere I go to find the code to do that, everyone says I need to used adaptive layout!!!
Can someone please take a moment to offer some advice? I tried asking Adam who did the recent tutorial on adaptive layout, but no response and it says he hasn’t logged in for over 7 months.
You can have two storyboards without duplicating the code for the child view controllers. Each ViewController can be assigned a class using the storyboard. If you have a class called FirstPageController, you can assign that to the first child view controller in each of the two storyboards. Ditto for Two through Six.
So to that end, can the same view controllers for the 6 individual ‘screens’ on iPhone that are all under a UIPageViewController, be the same UIViewController’s and code, for when they are all on screen at once in a uicontainerview?
I don’t see why not.
For the iPhone, you layout the page view controller, and its six child view controllers. For the iPad, you layout the container view, and its six child view controllers.
Then you assign the ViewOne class to the first view controller of each set; the ViewTwo class to the second view controller of each set; and so on.
At run time, you will activate one or the other, depending on what device it is on.
I’ll give it a go, thanks very much for taking the time to help! I’ll let you know how it goes.
@annemarie1185, how did it go? Did it work for you?
Still struggling to get it to work. Thinking of going to two different apps - one for iPad, one for iPhone.
posting what you have so far can get you pointers and help from the community on what you have done and what you can do to fix it.
You might as well close it.
This topic was automatically closed after 166 days. New replies are no longer allowed.