I just finished the tutorial on the “Bulls Eye” app.
It uses a view to embed all the buttons and labels so that they’ll be properly displayed
on all the different iPhones by adding constraints to the view only.
I would like to apply these same procedures, for an app, built for use on any iPad.
I’ve tried it but was unsuccessful. My layout would work for one iPad but not all the
others.
So, my question is what’s the solution for the layout, of an app running on all the iPads
without having to apply constraints to all the individual objects and instead applying
the constraints to a view only with the objects embedded just like the “Bulls Eye” app.
I hate to think that I would have to do a separate layout for each iPad.
Without actually having tried it and based just on my memory of what is involved, I believe you should be able to do the same thing for iPad too. You’d just need to set up layout constraints to center the view both horizontally and vertically on the iPad and it probably should work.
However, given that I haven’t tried it, “probably” would be the operative word here. If it does not work, please share your code and I (or someone else) can take a look.
Also, do note that this approach is not what I’d recommend for a production app since your view will not adjust to the available screen size. It will simply place your controls in the center of the screen but leave a lot of empty space around …
I tried embedding objects, in a view, and then centering it on an iPad Pro 12.9 and it displays
properly but when I display it on an iPad Pro 10.5 and an iPad Pro 9.7 the view is centered
but the objects are skewed off center.
The reason I thought about using the embedding objects in a view is because the actual app
that I’m building has over 68 objects on one view controller! I tried to constrain them instead of embedding them and it turned out to be a major mess.
So, what’s the solution, for the layout on an iPad, for that many objects?
Thanks,
Gary
Attached is a test app, on the iPads, using 4 objects one of which is a view with 3 embedded
objects. I built it on the iPad Pro 12.9 and when I display it on an iPad 10.5 and an iPad 9.7 the objects are off center.