UICollectionView内的UITableViewCell的 - 自动版式 [英] UICollectionView inside of UITableViewCell - AutoLayout

查看:110
本文介绍了UICollectionView内的UITableViewCell的 - 自动版式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 UICollectionView 的UITableViewCell 里面。这一切都工作正常,但我有自动布局的一些问题。在 UICollectionView 应该只是没有表现出水平或垂直scrolling.Because细胞现在我有一个滚动 UICollectionView 里面我的UITableViewCell 以下code不适合我的工作就是让动态表细胞的高度,这种细胞,但对其他细胞。

I'm using a UICollectionView inside of a UITableViewCell. It's all working fine, but i have some issues with Auto Layout. The UICollectionView should just show the cells without horizontal or vertical scrolling.Because now I have a the scrollable UICollectionView inside my UITableViewCell the following code doesn't work for me to get the dynamic table cells' height for this cell, but for other cells.

self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = 44

我未选中选项启用滚动在故事板,但结果是,我只是不能滚动,并没有看到我的CollectionView的其余部分。
现在,我只是从我的 UICollectionView 设置限制到的UITableViewCell 来所有的边缘,但它不工作。

I unchecked the option "scrolling enabled" in storyboard, but the result is, that i just can't scroll and don't see the rest of my collectionView. Right now I simply set constraints from my UICollectionView to the UITableViewCell to all edges, but it's not working.

将是巨大的,如果有人有一个主意。

Would be great if someone have an idea.

非常感谢。

推荐答案

您需要有一个高度约束你的 UICollectionView 设置。如果您刚刚固定你的 UICollectionView 你的的UITableViewCell ,它获取其表单元格和表单元格高度从集合电池获取其高度,所以没有真正知道在这种情况下该怎么做。

You'll need to have a height constraint set on your UICollectionView. If you've just pinned your UICollectionView to your UITableViewCell, it's getting its height from the table cell and the table cell is getting its height from the collection cell, so neither really knows what to do in that situation.

这篇关于UICollectionView内的UITableViewCell的 - 自动版式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆