2016-09-14 70 views
0

我有一个UITableView与4 UITableViewCell里面。我希望它通过设置是动态的:UITableView与嵌入UICollectionView不工作

tableView.estimatedRowHeight = 44 
tableView.rowHeight = UITableViewAutomaticDimension 

对于第三单元,采用内嵌式UICollectionView,它有20 UICollectionViewCell。

当我跑我的项目中,uicollectionviewcell回报(44,44),它显示这些错误:

The behavior of the UICollectionViewFlowLayout is not defined because: 
the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values. 
The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fe028c25bd0>, and it is attached to <UICollectionView: 0x7fe029884800; frame = (20 0; 335 44); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x60000024bbb0>; layer = <CALayer: 0x6000002269c0>; contentOffset: {0, 0}; contentSize: {0, 44}> collection view layout: <UICollectionViewFlowLayout: 0x7fe028c25bd0>. 
Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger. 

enter image description here

感谢进步。

+0

什么问题? – Krumelur

回答

0

那么调试器告诉你什么是错的:

frame = (20 0; 335 44)

这是你的CollectionView框架,这意味着的CollectionView的身高只有44px,这也是你的高度。所以,它不适合与电池插入值的CollectionView ...

检查您的CollectionView框架和约束的autoLayout

0

增加身高您的收藏观点或减少你的,因为你您的收藏鉴于细胞的高度采集视图的高度为44,单元格的高度也为44。你的细胞或物品的高度必须小于收集视图的高度!