2
我需要在選定的行下添加一個新行。我使用這個代碼在didSelectRowAtIndexPath方法:UITableView insertRowsAtIndexPaths刪除單元格分隔符
[_dataSource insertObject:newDataObject atIndex:indexPath.row + 1];
NSMutableArray *indexPaths = [NSMutableArray array];
NSInteger currentCount = indexPath.row;
[indexPaths addObject:[NSIndexPath indexPathForRow:currentCount+1 inSection:0]];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
它增加了在正確的位置的新行,但它還會刪除所選行的表面細胞分離器。我究竟做錯了什麼?
會不會是你的新細胞具有高度不正確? –
不,因爲當我在cellForRowAtIndexPath中創建單元格時,我總是使用相同的高度。內容也是一樣的。 – Heisenberg
我問過我有一個問題,因爲我改變了原型單元格的數量,並且單元格被調整大小:)並且互相重疊 –