後執行reloadSections我需要執行需要[self.tableView endUpdates]做動畫
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
// The fetch controller has sent all current change notifications, so tell the table view to process all updates.
[self.tableView endUpdates];
}
做動畫
[[self tableView] reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];
後。
我想這樣做,因爲我需要重新配置部分中的某些單元格,當從該部分刪除單元格時。這是因爲該部分的第一個和最後一個單元格的背景不同於它們之間的單元格。單個單元格具有不同的背景。 如果我不重新配置該部分中剩下的單元格,可能會導致一個不協調的視圖。
controllerDidChangeContent期間調用reloadSection過早並崩潰,因爲無法再找到單元格。
我試圖把在該行之前我endUpdates說法,卻得到了一個 「 'NSInvalidArgumentException' 的,理由是:「 - [UITableView的reloadSections:]:無法識別的選擇發送到實例」 味精。 – P5ycH0
糟糕,這是因爲reloadSections需要2個參數,而不是1 ...編輯。 – GendoIkari
謝謝,這解決了我的問題! – P5ycH0