Reputation: 79
I'm trying to create a iOS app, but I'm stuck on the layout.
I created the home view, but now I see that it's not shown in the right way in the 4S simulator.
I tried with size classes, but it looks like 4S and 6, for example, are in the same size class, and so I can't set a different dimension for views.
My goal is to support all devices, also iPads. Can someone please tell me how to do it?
Upvotes: 0
Views: 89
Reputation: 53
I am think that you use code Instead design in main.storyboard ! for ex: create button with code (and use Ratio in your code)
by this way i create small app for iPhone & iPad !
Upvotes: 0
Reputation: 31
I am just sharing an idea Option1: I think You can try adaptive Layouts and in file inspector->simulated Metrics->size-> Inferred. It works in all devices it supports both landscape and Portrait.
Option2: Go for Visual layouts they are easy to understand and they work perfect in all modes of Portrait.
Upvotes: 0
Reputation: 1006
Size classes mostly used for separation between ipad, apple watch and landscape modes.In potrait mode iphone 4 to iphone 6 all phone device sizes are in same class(regular height and compact width).Autolayout has many different constraints to help you to fit interfaces in same class.You should consider horizontaly/verticaly align, equal width and aspect ratio constraints.They are so flexible for smaller size changes and help you to design adaptive layout.
Upvotes: 1
Reputation: 349
You should use "Reset to Suggested Constraints" for all views in your View controller. You can also check the simulated metrics for all devices without compiling the the code. For 4s and 6 by default the size is Inferred. You should try resetting the constraints to check this for iPad as well.
Upvotes: 0