How to set dynamic width amp; height of a view in autolayout in iOS?(如何设置动态宽度amp;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自动布局中视图的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何设置动态宽度&iOS自动布局中视图的高度?
基础教程推荐
- :hover 状态不会在 iOS 上结束 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
