我有一個UITableView
聲明委託方法。動態更新numberOfRows
& numberOfSections
。UITableView - 使用reloadRowsAtIndexPath
(NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section{}
(NSInteger)numberOfSectionsInTableView:
除了使用[tableView reloadData]
,我將需要使用reloadRowsAtIndexPath
。
但是,我得到了無效行數的崩潰。我如何處理dataSource更改?讓我說我有一個數10的數組,並且當我通過拉動來從UIRefreshControls
重新加載UITableView
時,以及來自服務器的數據。從10開始,如果陣列的數量下降到1,我將如何處理reloadRowsAtIndexPath
?
[self.tableView reloadRowsAtIndexPaths:[self.tableView indexPathForVisibleRows] withRowAnimation:UITableViewRowAnimationNone]
這個被調用時似乎會崩潰。我將如何處理數據數組數的變化?
可能有多個部分。該部分可以更新刷新數據 –
然後,您可以使用通過' - reloadSections:withRowAnimation:'涉及的部分的索引集... – Alladinian