我正在使用tableview单元格中的KPDDropDownMenu,滚动菜单时,旧的重用单元格中的对象就会出现。
我的问题是在这种情况下如何重用
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let searchObject = searchObjects[indexPath.section]
let cell = tableView.dequeueReusableCell(withIdentifier: searchObject.viewIdentifier, for: indexPath)
(cell as! CommonSearch).setup(withSearchObject: searchObject)
(cell as? _DropDownTVC)?.dropDownOptions.optionsDidAppearedWithHeightClosure = {
(optionsHeight) in
self.searchObjects[indexPath.section].viewHeight += optionsHeight
tableView.beginUpdates()
tableView.endUpdates()
}
return cell
}
func setup(withSearchObject searchObject: SearchObject) {
searchkeyL.text = searchObject.searchKey
dropDownOptions.items = searchObject.options
}