Ios UItableView中的UICollectionView仅获取空的tableview,我错过了什么?
我需要在表视图单元格中使用集合视图,但是,我得到了一个银行表视图单元格。有人能告诉我缺少什么吗 !![我的故事板] 包含 看法 Tableview, TableViewCell, Contentview, collectionview, collectionviewcell。 里面 imageview和标签以显示数据 我有三节课 第一个customcollectionview 二, 三,Ios UItableView中的UICollectionView仅获取空的tableview,我错过了什么?,ios,xcode,swift,Ios,Xcode,Swift,我需要在表视图单元格中使用集合视图,但是,我得到了一个银行表视图单元格。有人能告诉我缺少什么吗 !![我的故事板] 包含 看法 Tableview, TableViewCell, Contentview, collectionview, collectionviewcell。 里面 imageview和标签以显示数据 我有三节课 第一个customcollectionview 二, 三, 有人能告诉我我缺少什么吗?似乎您正在为某些元素添加子视图,但没有为您的collectionView添加子视图
有人能告诉我我缺少什么吗?似乎您正在为某些元素添加子视图,但没有为您的collectionView添加子视图: 我看到为标签添加的视图:
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
headerView.addSubview(labelTitle)
headerView.addSubview(descriptionTitle)
您还需要添加集合视图。您可以在此处执行此操作,以便将其添加到每个单元格中:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:CustomTableViewCell? = tableView.dequeueReusableCellWithIdentifier("CELL") as? CustomTableViewCell;
我没有在另一个项目上使用addSubview来实现这一点。在我的情况下,我发起了
collectionView.datasource = self
collectionView.delegate = self
我最近发布了一个类似的问题,有人用一种可能对你有帮助的方法回答 谢谢你的回复,安德鲁,我正在经历这一切
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
headerView.addSubview(labelTitle)
headerView.addSubview(descriptionTitle)
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:CustomTableViewCell? = tableView.dequeueReusableCellWithIdentifier("CELL") as? CustomTableViewCell;
collectionView.datasource = self
collectionView.delegate = self