【发布时间】:2015-07-23 01:17:53
【问题描述】:
我有一个 tableView,其中的行需要水平流动的 collectionView。
我的 tableView 单元格中有一个 collectionView,然后我像这样实例化它们:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: MyTableViewCell = tableView.dequeueReusableCellWithIdentifier("MyTableViewCell", forIndexPath: indexPath) as! MyTableViewCell
let nibName = UINib(nibName: "CollectionCell", bundle: nil)
cell.collectionView.registerNib(nibName, forCellWithReuseIdentifier: "CollectionCell")
cell.collectionView.dataSource = self
cell.collectionView.delegate = self
return cell
}
我正在尝试使用自动高度表视图行,我认为这可能会导致问题。如何将 UITableViewAutomaticDimension 与内部集合视图一起使用?
【问题讨论】:
-
您可能需要在设置好委托和数据源后调用
reloadData -
@Qazi 在 cellForRowAtIndexPath 中这样做了,没有效果。
-
对不起,我没说清楚,所以你在集合视图上调用
reloadData,而不是在 TableView 上? -
@Qazi 是的。在集合视图上。
标签: ios swift uitableview uicollectionview