gpt4 book ai didi

ios - 在 Storyboard 中设置 subview 相对于父 View 的高度

转载 作者:可可西里 更新时间:2023-11-01 03:39:02 25 4
gpt4 key购买 nike

我在 UIViewController 的 View 中有一个 UIImageView。我想要的是将它的高度设置为 1/3rd,无论屏幕尺寸是多少。我当然知道如何从代码中做到这一点。但是如何仅使用 Storyboard/Interface builder 来实现这一点呢?

最佳答案

添加一个高度约束,其乘数值为1/3,这样 ImageView 的高度将是其父 View 高度的三分之一。

enter image description here

--

这是它在不同设备尺寸下的样子:

Bad rendering on small screen Bad rendering on small screen Bad rendering on small screen

关于ios - 在 Storyboard 中设置 subview 相对于父 View 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39695115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com