【发布时间】:2020-03-19 04:20:01
【问题描述】:
我正在构建一个 iOS 应用,它有多个 collectionView,有些是水平的,有些是垂直滚动的。
我希望它们一起垂直滚动我阅读了很多博客并知道可以使用 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 中显示。
【问题讨论】:
-
你需要先学会使用TableView和CollectionView。作为初学者,不要直接跳到复杂的布局。先看一些教程,把基础搞清楚。
-
不要使用嵌套,使用单个collectionview很容易完成
-
你可以参考这个链接collectionviewcell inside tableviewcell stackoverflow.com/questions/59043807/…
标签: ios swift uitableview uiviewcontroller uicollectionview