我更新我UITableView
用下面的代碼:UITableViewDataSource方法沒有得到所謂的
int index = [self.guests indexOfObject:_guests];
[[self tableView] beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:index inSection:0]] withRowAnimation:UITableViewRowAnimationLeft];
[[self tableView] endUpdates];
但調用[[self tableView] endUpdates]
,它不是調用其數據源的方法之後。在添加行的情況下,它會調用它的數據源方法。我認爲在刪除的情況下,它不需要向其數據源請求任何東西,但是在添加一行的情況下,它需要詢問它的數據源幾乎所有有關添加像cellForRow,高度等等的新行的一切。我只是想確保它是正確的,如果deleteRowsAtIndexPaths
不調用它的任何數據源方法?
你是否有所有的細胞可以在同一時間嗎? – 2013-05-08 10:03:45
你需要調用'[tableView reloadData];'endUpdates – 2013-05-08 10:07:44
after no reloadata,tableView不會調用它的委託方法?@AhmedZ。 – 2013-05-08 10:12:46