我有一个相当复杂的视图布局:
ViewController
- TableViewController inside ContainerView (as child view controller)
- TableViewCell which holds UICollectionView with subclassed (custom) FlowLayout
当我尝试通过我的子类FlowLayout添加UICollectionElementKindSectionHeader
补充视图时,我收到以下错误:
*** Assertion failure in -[MyCollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:], /SourceCache/UIKit_Sim/UIKit-2935.137/UICollectionView.m:1305
此处提出的尝试解决方案:UICollectionView + iOS 7 / Xcode 5 = Assertion Failure 但没有任何运气。我正在为我的TableViewCells使用动态自动布局高度,我想知道是否可能需要做它...
任何人都有想法或者可以指出我正确的方向进行故障排除?谢谢!
答案 0 :(得分:1)
呃..我在我的代码中找出导致Assertion Failure
的原因。由于我在TableViewCells中复杂地嵌套了CollectionViews,所以在访问其布局之前我没有设置CollectionView的dataSource
属性...