ios - 什么是 'UIView-Encapsulated-Layout-Width' 约束?

标签 ios uicollectionview autolayout nslayoutconstraint uicollectionviewlayout

我不断收到“无法同时满足约束”异常(Xcode 5、iOS 7、设备和模拟器),其中列表中的约束之一如下所示:

"<NSLayoutConstraint:0x165b23d0 'UIView-Encapsulated-Layout-Width'
H:[StoryPlayerCell:0x165affc0(0)]>"

我自己没有设置这个约束。它也不是 NSAutoresizingMaskLayoutConstraint。 但它从何而来?我怎样才能摆脱它?

我不知道。 而且我在 Apple 的文档中找不到任何关于 'UIView-Encapsulated-Layout-Width' 的内容。 甚至谷歌搜索也没有返回任何结果。

有什么建议吗?

PS:我在 UICollectionView 中使用此单元格,其中包含 UICollectionViewFlowLayout 的自定义子类。也许 'Encapsulated-Layout' 部分与此有关?

最佳答案

一个快速而有效的修复方法是将 999 优先级值分配给具有高优先级的自定义约束。封装和自动生成的约束应该比您的约束具有更高的优先级。

https://stackoverflow.com/a/25795758/590010

关于ios - 什么是 'UIView-Encapsulated-Layout-Width' 约束?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21161765/

相关文章:

ios - 从 UICollectionView 的一个部分中删除一行似乎不会删除关联的标题

ios - '尝试滚动到无效的索引路径 : {length = 2, path = 0 - 4}

ios - 自动布局确定 subview 的大小

uiview - 如何创建定义基线的自定义 UIView?

ios - 根据indexPath.section和indexPath.row判断多维结构的cell类型

ios - 核心数据 - 检查是否为 null - iOS

ios - Swift 4.2 - 如何从 tableView 中的 "indexPath.row"方法调用 "didSelectRowAtIndexPath"到另一个类?

ios - 如何更改 UINavigationController 背景颜色?

ios - UICollectionView 中的 viewForSupplementaryElementOfKind 返回 nil 并使用 swift 使应用程序崩溃

ios - 如何使用自动布局将按钮放在屏幕底部