问题
I have developed an app which should support both iPhone & iPad. I have designed screens using xocde 6 with autolayout. But the issue is, screens of my app looks good for iPhone but not for iPad. I have gone through This Link
It says we should use size class for iPad & design our UI for iPad. So should i use separate size class for iPad? Doing this i will again have to design the UI for iPad. So is it the best way of designing screen using auotlayout?
回答1:
If you don't want to use size class then there is a way that your screens may look good in both devices. Obviously you need to redesign the screens. If you change some of your constraints to Aspect Ratio and ProportionalWidth and ProportionalHeight and you can fix them for both devices. Suppose there is a view in the middle of controller and you want to view proper in both device then you need to add CenterX to superview, CenterY to superview, ProportionalWidth to superview and ProportionalHeight to superview. And it will look perfect in both devices. If you need further suggestion in any situation then edit your question and i will tell you which constraint you should use to look the screen proper in both devices. Thanks.
回答2:
Yes you must do your layout independently for phone and tablet using the size class selector. A layout that works for a phone is highly unlikely to also work for tablet, or indeed iPhone 5 versus iPhone 4/6.
You may similarly need to also do landscape and portrait layouts using the size class selector if it makes sense to your project.
Try this site for great tutorials on all things iOS, including adaptive layouts.
来源:https://stackoverflow.com/questions/31156747/issue-in-designing-layout-for-ipad-iphone