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自动布局中视图的高度?


- URL编码Swift iOS 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- UITextView 内容插图 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01