如何准备在tableviewcell中重用“ KPDDropDownMenu”?

时间:2019-01-30 11:49:07

标签: ios swift uitableview cocoapods

我正在使用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
}

0 个答案:

没有答案