视图
解决方案:
1、cell subview配置
// cell 添加背景view
cell.backView.tag = indexPath.row
// 热门城市 tag = -1
cell.titleLabel.tag = -1
2、CollectionView所在的TableviewCell中处理
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let view = super.hitTest(point, with: event)
guard let eView = view, eView.isDescendant(of: collectionView) else { return view }
if let tag = eView.tag, (-1 < tag && tag < sourceArr.count && !(eView is UICollectionView)) {
currentCity = sourceArr[tag]
collectionView.reloadData()
}
return collectionView
}