Как подготовить к повторному использованию "KPDDropDownMenu" в tableviewcell? - PullRequest
0 голосов
/ 30 января 2019

Я использую 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
}
...