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
我问过我有一个问题,因为我改变了原型单元格的数量,并且单元格被调整大小:)并且互相重叠 –