【问题标题】:Assertion Failure - CollectionView inside UITableViewCell with Auto-Layout and custom UICollectionViewFlowLayout断言失败 - 带有自动布局和自定义 UICollectionViewFlowLayout 的 UITableViewCell 内的 CollectionView
【发布时间】:2014-07-16 01:12:11
【问题描述】:

我有一个相当复杂的视图布局:

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 使用动态自动布局高度,我想知道是否可以这样做...

任何人有想法或可以指出正确的方向来解决问题吗?谢谢!

【问题讨论】:

标签: ios uicollectionview autolayout uicollectionviewlayout


【解决方案1】:

呃.. 我找出了导致我的代码中出现 Assertion Failure 的原因。由于我在 TableViewCells 中复杂地嵌套了 CollectionViews,因此在访问其布局之前我没有设置 CollectionView 的 dataSource 属性...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多