每个人都在写关于删除部分的文章。好吧,我似乎无法添加一个。
目前,我正在尝试这样(失败并出现 NSInternalInconsistencyException):
UITableView *tv = (UITableView *) self.tableView;
if ([tv numberOfSections] == 1)
{
[tv beginUpdates];
[tv insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
NSLog(@"Inserted.. Brace for impact.");
[tv endUpdates];
}
NSLog(@"Section count after update: %d", [tv numberOfSections]); // Never reached
如果我是正确的,插入索引为 0 的部分应该将其放在顶部,将所有其他部分向下碰撞,对吗?好吧,如果我在 insertSections 之后立即写出 numberOfSections,则节数似乎没有变化。
有任何想法吗?
约翰