ios - 在 ViewController 中设置 TableView 和 collectionView
问题描述
我正在构建一个具有多个 collectionView 的 iOS 应用程序,有些是水平的,有些是垂直滚动的。
我希望它们一起垂直滚动我阅读了很多博客并知道可以使用 UITableView 来完成。我在 ViewController 中实现 UITableView 和 UICollectionView 这会引发错误。
错误:
Showing Recent Messages
The dealCollectionViewCell outlet from the BusinesViewControllerr to the UICollectionView
is invalid. Outlets cannot be connected to repeating content. [12]
Showing Recent Messages
The dealTableViewCel outlet from the BusinesViewControllerr to the UITableViewCell is
invalid. Outlets cannot be connected to repeating content. [12]
我是新来的 swift 有没有人可以帮助我理解这个错误以及如何解决这个问题。
我制作了一个示例项目,在其中制作了 tableView 和 collection view 不同的类,它工作正常。我需要将其合并到 viewController 中,因为我正在使用 API 从服务器获取一些数据,并且需要在我的 4 个不同的 collectionView 中显示。
解决方案
您应该连接来自 UITableView 和 UICollectionView 的插座,而不是它们的单元格
推荐阅读
- pact - PactNet Provider 测试失败,因为运行测试时出现 404
- android - Android 工具栏自定义文本未显示
- angularjs - 带有打字稿的 Angular ng 控制器
- css - 如何使 CSS 网格行的高度不受彼此影响
- python - python dataframe 将Int转换为Str时,最后加上.0
- python - 通过 Python 的 join 方法隐式声明列表?
- linux - Eclipse 产品导出向导 - 没有可执行文件
- python - How to store the row value from csv in python?
- python - 如何在 rock64 系统上启用 /dev/spidev0,0?
- python - 检查 python 列表中的预定义匹配项