How can I use constraints AutoLayout with to specify a different layout on landscape vs. portrait without using code?

纵饮孤独 提交于 2019-11-30 13:22:02

You could achieve such behaviour using different priorities for constraints in Interface Builder. For both views ("Company Logo" and "Login view") you need to set up "vertical center in container" and "horizontal center in container" constraints with some reduced priority. Next you need to defined "Vertical Space" and "horizontal space" constraints using rules with relations like "Less Than or Equal".

I've achieved such behaviour just using Interface Builder.

Also you could combine "less than or equal" with "greater than or equal" using different priorities to achieve best result.

instead of repositioning the elements, it looks like you just need to rotate them individually. Set them up in a container view, center the container view in the view controllers view. Then just set up the distance between the two views and setup the autorotation on them.

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