自从我更新到 Xcode 7.3 后,我遇到了 UIStackView
的问题.如果我创建一个空项目并将两个 UILabel
放入具有默认拥抱和压缩优先级的 UIStackView
中,它会显示 AutoLayout misplacement 错误.它甚至不适用于 UIStackView
中的一个(!)UILabel
,所以优先级并不重要(我认为,也许有问题).
Since I've updated to Xcode 7.3 I have a problem with UIStackView
. If I create an empty project and just put two UILabel
s in UIStackView
with default hugging and compression priorities, it shows me AutoLayout misplacement error. It even doesn't work with one(!) UILabel
in UIStackView
, so priorities doesn't matter (as I think, maybe there is the problem).
我记得在 Xcode 7.3 之前的版本中一切都很好.我分别检查了两台 MacBook Pro,这是同一个问题.
As I remember in Xcode prior 7.3 everything was fine. I checked on two MacBook Pro separately, it's the same issue.
有人知道怎么解决吗?
这是 Xcode 7.3 中出现的一个 bug,所以你可以忽略它,就像他所说的 matt.
This is a bug appears in Xcode 7.3, so you can ignore it as what he said matt.
问题
使用 UIStackView 时,storyboard 无法计算子视图的内在内容大小
The storyboard can not calculate the intrinsic content size of subviews when you use UIStackView
解决方案
如果您讨厌在情节提要中看到警告,您可以像下面这样修复它:
If you hate seeing warnings in your storyboard you can fixe it like below :
您应该为 UIStackView
这样你不会看到警告,你可以看看是否存在任何歧义
Like that you will not see warnings, and you can see if any ambiguities exist
缺点是每次更改子视图时都应该执行此步骤(例如:更改 UILabel 的文本大小)
The disadvantage is you should do this steps each time you change your subview (example: changing the size of text of an UILabel)
希望 Apple 在下一个版本中修复此错误
Hoping that Apple fixes this bug in the next release
这篇关于Xcode 7.3 中带有 UILabel 的 UIStackView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!