当我尝试使用下面的代码更新我的表**UITableview**
时,我的单元格变得更小。我想知道是否有人面临同样的问题,并会知道为什么会发生这种情况。更新单元格时不一致的UITableViewCell大小
NSMutableArray* indexPaths = [[NSMutableArray alloc] init];
for (int i = 20; i < 20 + 20; i++) {
[indexPaths addObject:[NSIndexPath indexPathForRow:i inSection:0]];
}
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:(UITableViewRowAnimationBottom)];
[self.tableView endUpdates];
....
它可能是自动布局问题你检查它吗? –
这是我怀疑的wha,但我不知道从哪里开始。它恢复正常,但我向下滚动。值得注意的是,我正在使用自定义的“TableViewCell”类。在setFrame中,我设置了一些 ' - (void)setFrame:(CGRect)frame frame.origin.x + = 5; frame.origin.y + = 5; frame.size.width - = 2 * 5; frame.size.height - = 2 * 5; [super setFrame:frame]; } ' – CreativityKills
我发布了调整自动布局的答案。这可能会解决你的问题。 –