ExpandableCell: Cells randomly disappearing and titleLabel.text displays wrong text
Hey. I have 11 ExpandableCells and about 50 ExpandedCells. I am initializing it like that:
func expandableTableView(_ expandableTableView: ExpandableTableView, expandedCellsForRowAt indexPath: IndexPath) -> [UITableViewCell]? {
`var cells: [ExpandedCell] = []
for i in 0...platinumProteinMeals[indexPath.row].meals.count - 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: ExpandedCell.ID) as! ExpandedCell
print("\(indexPath) | \(i) | \(platinumProteinMeals[indexPath.row].meals[i])")
cell.titleLabel.text = platinumProteinMeals[indexPath.row].meals[i]
cell.isHidden = false
cells.append(cell)
}
return cells
}`
The platinumProteinMeals is an array of 11 NDDSections, one section would look like this:
NDDSection(category: "Beef", meals: ["Beef Avocado Salad", "Beef in Chili Sauce", "Beef Soup", "Beef Steak", "Beef Tartar", "Beef with French Beans", "Chilli Lime Beef", "Thai Beef Salad"])
My issue is that the cell randomly disappears (mostly while scrolling) and a wrong meal
of themeals
array is getting displayed. For example a Turkey meal is being displayed in the Beef ExpandableCell. Any idea how to fix this? Thanks in advance
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 19
@andrei0929 @Marolicious @kwongius @ezefranca @kennydust
I added tableView.reloadData() in the end of the the function of public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) waiting you respond if this helped you or not it is not the best solution I known but may be help