在我的tableview中,如果單數或奇數的單元格的背景顏色集合都是依賴的。用動畫插入UITableView的行(並更新所有其他單元格)
我想用動畫.top
插入新單元格,讓它們從tableview的頂部向下動畫。
然而,當這樣做時,它們與單元格的背景顏色有差異。我明白當使用tableView.insertRows
時,它只會爲插入的行調用cellForRow
。留下已存在的單元格以使其背景顏色錯誤。
我打過電話: tableView.beginUpdates()
tableView.insertRows()
tableView.endUpdates()
真的不知道如何解決這個問題。任何幫助讚賞。
需要重新載入你的表像這樣'tableView.reloadData()' – Rajat
@Rajat你不明白我的問題。我不想重新加載,因爲我想要動畫。 –
嘗試在'func tableView(_ tableView:UITableView,willDisplay cell:UITableViewCell,forRowAt indexPath:IndexPath)中添加自定義動畫' –