【发布时间】:2016-08-10 08:19:50
【问题描述】:
我正在使用自定尺寸UITableViewCells,它们总是缩小到可以达到的最小尺寸。这很棒。
但是,当我删除一个单元格时,这会导致其他单元格变大,直到它们下一次出列或重新加载。
我正在使用正确的UITableView 方法来删除数据源和单元格...
[self.tableView beginUpdates];
[self.dataSource deleteObjectsAtIndices:[self indexSetFromIndexPaths:@[indexPath]]];
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
NSArray *previousDataSourceState = [self.dataSource.objects copy];
[self.dataSource reconstructObjects];
NSArray *indexPathsToBeAdded = [self indexPathsOfObjectsFromDatasource:self.dataSource.objects notPresentInDataSource:previousDataSourceState];
[self.tableView insertRowsAtIndexPaths:indexPathsToBeAdded withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
我有什么遗漏吗?
这可能是限制的优先问题吗?例如内容压缩阻力和内容拥抱?
【问题讨论】:
-
有没有用??
标签: ios objective-c uitableview autolayout nslayoutconstraint