Autolayout views always same size on different screen sizes

Deadly 提交于 2019-12-24 16:33:22

问题


I have a view:

Can someone help me to layout these views that they all look the same on every iPhone? I mean size is dynamic and views shrink according to screen size.

I have tried aspect ration and other layout options but none helped.


回答1:


if you want to change the view sizes on different screens using auto layout ,you have to add the height and width constraints .then only it changes view size.

Steps:

  1. open your project in xcode.

  2. goto storyboard choose Auto layout ,select your view ,

  3. in Xcode From the Editor menu, choose Pin\Width and Height both

    http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1




回答2:


As per your question please look at the link below it might help solving your problem of multiple views size and layout.

https://stackoverflow.com/a/27471120/4101371

you can also refer:

https://www.youtube.com/watch?v=Nl2iMF0yKW8&list=PLXCowKcXAVgrxHKLWTa4HxNPrSmTj3D-_

I've also added this link in the answer in above answer.



来源:https://stackoverflow.com/questions/28878202/autolayout-views-always-same-size-on-different-screen-sizes

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