什么是“UIView-Encapsulated-Layout-Width"约束? [英] What is a 'UIView-Encapsulated-Layout-Width' constraint?
问题描述
我不断收到无法同时满足约束"异常(Xcode 5、iOS 7、设备和模拟器),其中列表中的约束之一是这样的:
I keep getting 'Unable to simultaneously satisfy constraints' exceptions (Xcode 5, iOS 7, both device and simulator), where one of the constraints in the list is something like this:
"<NSLayoutConstraint:0x165b23d0 'UIView-Encapsulated-Layout-Width'
H:[StoryPlayerCell:0x165affc0(0)]>"
我自己没有设置这个约束.它也不是 NSAutoresizingMaskLayoutConstraint
.但它来自哪里?我怎样才能摆脱它?
I did not set this constraint myself. It's also not an NSAutoresizingMaskLayoutConstraint
.
But where does it come from? And how can I get rid of it?
我不知道.而且我在 Apple 的文档中找不到任何关于 'UIView-Encapsulated-Layout-Width'
的信息.甚至 Google 搜索也没有返回任何内容.
I have no idea.
And I can't find anything about 'UIView-Encapsulated-Layout-Width'
in the Apple's documentation.
Even the Google search returns nothing at all.
有什么建议吗?
PS:我在 UICollectionView
中使用此单元格,并带有 UICollectionViewFlowLayout
的自定义子类.也许 'Encapsulated-Layout'
部分与此有关?
PS: I'm using this cell in a UICollectionView
with a custom subclass of UICollectionViewFlowLayout
. Maybe the 'Encapsulated-Layout'
part has something to do with this?
推荐答案
一个快速而好的解决方法,是将 999
优先级值分配给具有高优先级的自定义约束.封装的 &自动生成的约束应该比您的约束具有更高的优先级.
A quick and nice fix, is to assign 999
priority value to the custom constraints with high priority. The encapsulated & auto-generated constraints should dominate with higher priority than your constraints.
https://stackoverflow.com/a/25795758/590010
这篇关于什么是“UIView-Encapsulated-Layout-Width"约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!