自动布局视图在不同的屏幕尺寸上始终具有相同的尺寸 [英] Autolayout views always same size on different screen sizes

查看:101
本文介绍了自动布局视图在不同的屏幕尺寸上始终具有相同的尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视图:

有人可以帮我布置这些视图,使它们在每台iPhone上看起来都一样吗?我的意思是大小是动态的,视图根据屏幕大小而缩小.

我尝试了宽高比和其他布局选项,但没有帮助.

解决方案

如果要使用自动布局在不同屏幕上更改视图大小,则必须添加高度和宽度约束.然后,它只能更改视图大小./p>

步骤:

  1. 使用xcode打开您的项目.

  2. 转到情节提要板中,选择自动布局",选择您的视图,

  3. 在Xcode中,从编辑器菜单中,选择Pin \ Width和Height

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

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.

解决方案

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

这篇关于自动布局视图在不同的屏幕尺寸上始终具有相同的尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆