Swift 从CollectionViewCell重新加载TableView
有人知道如何重新加载Swift 从CollectionViewCell重新加载TableView,swift,uitableview,uicollectionview,uicollectionviewcell,reloaddata,Swift,Uitableview,Uicollectionview,Uicollectionviewcell,Reloaddata,有人知道如何重新加载CollectionViewCustomCell中的TableView吗?我有一个IBOutlet的表,访问该表的唯一方法是在cellForItemAtIndexPath方法中,我可以通过该方法访问我的CollectionViewCustomCell访问表 cell.tableViewInsideOfCollectionViewCell.reloadData() 但这只适用于第一次加载,当我更改CollectionViewsource时,它将不会重新加载TableView
CollectionViewCustomCell中的TableView吗?
我有一个IBOutlet
的表
,访问该表
的唯一方法是在cellForItemAtIndexPath
方法中,我可以通过该方法访问我的CollectionViewCustomCell
访问表
cell.tableViewInsideOfCollectionViewCell.reloadData()
但这只适用于第一次加载,当我更改CollectionView
source时,它将不会重新加载TableView
如果您需要更多信息,请询问
提前谢谢 可以使用
collectionView.cellForItem(at:IndexPath)
方法获取单元格。然后将其强制转换为包含tableView的单元格类型。现在您可以访问该单元格属性并可以重新加载tableView
guard let cell = collectionView.cellForItem(at: IndexPath(row: , section: )) as? CustomCellWithTableView else { return }
cell.tableView.reloadData()
非常感谢@贾斯汀