Autolayout just not working for every screen size

故事扮演 提交于 2019-12-11 05:06:35

问题


My app is a game and the menus have many labels and buttons and I cannot get all of the different screen sizes(iPhone 4/5/6/6+) to look acceptable from the same set of constraints.

Is there a way that you use to synchronize all the views together to look the same on all different screen sizes?

The project is locked to only portrait so I don't need to consider rotation.


回答1:


For Autolayout, you

  1. Consider the screen sizes you want to support.
  2. Which view/buttons/labels/imageview etc you want to remain fixed while in different screen size.
  3. Which view/buttons/labels/imageview etc can be scaled to fit the screen.

Now if by scaling the things you can fit on the screen then you are good to go. But if you still can't find way then you would probably need to you use scrollview and and add a UIView (let's call it content view) to it put your all stuff in it and constraint them vertically all the way from top to bottom.This video can help you if you want to use scrollview https://www.youtube.com/watch?v=UnQsFlMGDsI



来源:https://stackoverflow.com/questions/29559847/autolayout-just-not-working-for-every-screen-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!