如何设置动态宽度&iOS自动布局中视图的高度? [英] How to set dynamic width & height of a view in autolayout in iOS?

查看:14
本文介绍了如何设置动态宽度&iOS自动布局中视图的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的超级视图中有一个 UIView.我已经设置了一些约束.现在我希望不同设备上的视图大小应该不同.如果我设置了固定宽度 &高度然后我得到错误的结果.我尝试使用用户纵横比,但这会使多个设备上的视图太大或太小.

I have a UIView in my super view.I have set it some constraints.Now I want the size of view should be different on different devices.If I set the fix width & height then I get the wrong result.I have tried to user aspect ratio but that make a view too big or too small on multiple devices.

我想要身高&宽度应该以相同的比例增加,它必须在所有设备上看起来都一样.我想要灵活的视图高度和宽度.请告诉如何做到这一点?

I want the height & width should increase in equal proportion that it must look same all devices.I want to have flexible height and width of the view.Please tell how to do this?

这是图片

提前致谢

推荐答案

使用大小类.它有助于为不同的设备进行不同的设置.http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorialhttps://youtu.be/IwSTXY0awng?t=2m12s

Use Size Classes. It helps to have different settings for different devices. http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial https://youtu.be/IwSTXY0awng?t=2m12s

这篇关于如何设置动态宽度&iOS自动布局中视图的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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