是否可以根据Xcode故事板中的屏幕尺寸来调整固定距离?

发布于 2025-02-03 18:09:25 字数 99 浏览 1 评论 0原文

例如,我不想在像iPhone 5这样的小屏幕上固定,但是在新iPhone上,我确实想要一些固定。有什么办法可以做到吗?我真的是自动布局和Swift的新手,并且已经被抛入了工作中的深处。

For example, I want no pinning on a small screen like an iPhone 5, but on the new iPhones, I do want some amount of pinning. Is there any way this can be done? I'm really new to Auto Layout and Swift and have been thrown into the deep end at work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落花浅忆 2025-02-10 18:09:25

您不应直接根据屏幕尺寸或设备模型做出布局决策。

如果优先级较低,则可以优先考虑该系统,如果可以的话,系统可能会尝试适应它。如果我正确记得的话,最高优先级是1000。

在这种情况下,如果您想在可用空间的屏幕上进行僵持,并且如果屏幕太小,则不会隔离,请添加约束,但请将其降低优先级。说750或500。

You should not make layout decisions based on screen size, or device model, directly.

A constraint has a priority if that priority is low, the system may try to accommodate it, if it can. The highest priority is 1000 if I remember properly.

In this case, if you want a stand-off on screens where space is available, and no stand-off if the screen is too small, then add the constraint, but put it a a lower priority. Say 750 or 500.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文