我有一个带有部分和索引标题的 UITableview
。当用户单击一个单元格时,该单元格中会显示一个高度为 42 的选项 View 。为了显示该选项,我重新加载了单元格。但是节标题也在更新。这给出了奇怪的动画。如何仅重新加载单元格,而不会调用其他委托(delegate)方法,如 heightForHeaderInSection
和 viewForHeaderInSection
。
最佳答案
我认为你应该只更新 indexPath 的特定行,试试下面的代码
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
[tableView beginUpdates];
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView endUpdates];
}
它可能对你有帮助。
干杯。
关于ios - 在不重新加载标题部分的情况下重新加载 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37114773/