gpt4 book ai didi

autolayout - iOS Autolayout 根据屏幕大小设置宽高

转载 作者:行者123 更新时间:2023-12-03 18:49:31 26 4
gpt4 key购买 nike

在 iOS Autolayout 中,我应该添加什么约束来设置与 Superview(在我的例子中是 UIViewController 的 View )成比例的宽度和高度,使用 Autoresizing 我们可以像下面显示的图片那样做。

enter image description here

最佳答案

如果 uiviewcontroller 中有 uiview。

  1. 您必须在该 uiview 的容器约束中添加水平和垂直中心。

  2. 您需要为您的 super View 为该 uiview 添加等高和等宽约束。

  3. 同时选择等高约束和等宽约束,并根据需要为该约束添加乘数。

关于autolayout - iOS Autolayout 根据屏幕大小设置宽高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27246687/

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