[英]How to maintain UIView ratio across different devices using Autolayout?
我在LaunchScreen有一个UIView 。
LaunchScreen
UIView
我向此UIView添加了以下约束。
我希望我的红色视图始终35%屏幕的35% 。
35%
我将RedView的高度计算为:我的ViewController高度为667我计算了35%高度并分配给RedView 。
RedView
ViewController
667
我想知道那是我的方法是正确的。 由于它们的iPhone6Plus宽度变化iPhone6Plus ,高度变化很大。
iPhone6Plus
我的约束是否适合35:65屏幕。
除了给出长宽比,您还可以给它35%的倍数。
步骤1:从3个侧面固定RedView , Right-Top-Left
Right-Top-Left
步骤2:将RedView和ViewController的主视图设置为相等的高度。
步骤3:选择RedView's等高约束,然后转到其属性检查器。 (第4个右标签)
RedView's
步骤4:将 “ Multiplier值更改为0.35 。
Multiplier
0.35
现在,在两个方向中,RedView始终将占主屏幕的35% 。
[英]Keeping aspect ratio and autolayout for different devices
[英]how to set autolayout for different devices by using storyboard
[英]Autolayout aspect ratio for UIImageView / UIView
[英]iOS autolayout aspect ratio for UIView
[英]Autolayout Rendering inconsistently across devices
[英]How to split UIView into equal parts using autolayout?
[英]How to draw a horizontal line using UIView and autolayout?
[英]How to Resize UIView for universal application using Autolayout
[英]How resize UIView With inner UITextView using Autolayout?
[英]How to change frame of uiview is using autolayout in iOS?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.