gpt4 book ai didi

ios - 为什么 Storyboard 中的 Use Standard Value 是灰色的?

转载 作者:技术小花猫 更新时间:2023-10-29 11:19:19 27 4
gpt4 key购买 nike

我想不通。有人能告诉我为什么以及如何启用“使用标准值”吗?

standard-value-disabled

最佳答案

标准值 是“建议的 View 间距”[1]。与边距或安全区域相关的约束已包含此推荐间距。这可能就是您看到“使用标准值”选项被禁用的原因。

要启用“使用标准值”选项,请将约束更改为不再与边距或安全区域相关。您可能还需要取消选中“尊重语言方向”。如果该选项仍然是灰色的,请尝试打开和关闭“Relative to margin”选项——它似乎有时会卡在 Interface Builder 中。

[1] https://help.apple.com/xcode/mac/8.0/#/deve7dfb37c9


我发现的一些进一步观察/背景似乎与理解该问题相关:

Prior to Safe Area Layout Guides, we had leading/trailing margins and Top / Bottom Layout Guides:

  • I understood that pinning views to the leading and trailing margins didn't have access to "Use Standard Value" because these margins already provide a standard value from the edges.
  • Top and bottom layout guides, on the other hand, merely indicated where top and bottom edges extended to, excluding navigation bars and status bars etc. Unlike leading and trailing margins, they didn't by default provide a standard distance from these bars etc, so constraints pinned to the Top and Bottom layout guides did have access to "Use Standard Value".

Top and Bottom Layout Guides are now deprecated in favor of Safe Area Layout Guides, which perform a similar function, indicating an area that will not be covered up by UIKit components such as Tab bars, Navigation bars etc. In iOS at least (tvOS seems another story) the safe area doesn't seem to indicate the edge + a standard distance (as leading and trailing margins did). But constraints don't have access to "Use Standard Value" either. (See it grayed out below) This means that if we use Safe Area Layout guides to constrain a view to the edges, we no longer have access to standard distances.

Is this an oversight, or am I missing something?

It also seems extremely buggy, for example:

  • Bug #1 - If you migrate a storyboard to Safe Area Layout Constraints, the top and bottom constraints do seem to have "Use Standard Value" selected (though the "standard value" seems to be 0). If you change to another value, however, there's then no way to return to "Use Standard Value". All very strange!
  • Bug #2 - If you have a good old fashioned leading or trailing constraint pinned to the root view that is set to "Relative to Margin" and you switch to "Safe Area", the "Relative to Margin" option disappears of course, but you cannot "Use Standard Value". HOWEVER - if you turn off "Relative to Margin" before switching to "Safe Area" then "Use Standard Value" is available with Safe Area Layout Margins. I've even encountered situations where I need to turn "Relative to Margin" on and then off again to then be able to "Use Standard Value". That said, this "standard value" seems to be 0, so doesn't seem to be working even if it's selected.[2]

[2] https://forums.developer.apple.com/thread/87028

关于ios - 为什么 Storyboard 中的 Use Standard Value 是灰色的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29018949/

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