gpt4 book ai didi

IOS - 如何按比例自动布局 View 并将其中心设置为 anchor

转载 作者:行者123 更新时间:2023-11-29 12:15:25 25 4
gpt4 key购买 nike

我正在尝试按比例布局 View ,例如 super View 顶部 20% 和左侧 50%。并将 View 中心设置为该点。

我已经尝试通过设置一个虚拟 View (橙色)来做到这一点,如下所示,但我似乎无法将白色 View 中心设置为 anchor 。

有什么想法吗?

enter image description here

以下是我使用的约束:

enter image description here

最佳答案

很简单,只需设置 View centerX 和 centerY 而不是使用 top 和 left。将使用 View 中心作为 anchor

关于IOS - 如何按比例自动布局 View 并将其中心设置为 anchor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32140883/

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