ios - 在不重新加载标题部分的情况下重新加载 UITableView

标签 ios swift uitableview

我有一个带有部分和索引标题的 UITableview。当用户单击一个单元格时,该单元格中会显示一个高度为 42 的选项 View 。为了显示该选项,我重新加载了单元格。但是节标题也在更新。这给出了奇怪的动画。如何仅重新加载单元格,而不会调用其他委托(delegate)方法,如 heightForHeaderInSectionviewForHeaderInSection

最佳答案

我认为你应该只更新 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/

相关文章:

ios - 无法禁用 UITableView 分组中部分的页脚

html - iPad 上的 iOS UIWebView 窗口宽度和高度

jquery - 使用自己的样式表在 JQuery Mobile 中定位 CSS

ios - PHAssetCollectionChangeRequest : addAssets() now accepts NSFastEnumeration. 这个怎么实现?

swift - 尝试使用 CLI 将 Vapor 应用程序推送到 Heroku 失败

ios 我想从 AppDelegate 访问 MainViewController 中的对象

ios - 如何在删除 IOS 应用程序时删除文件?

ios - 关闭应用程序时, bool 值未设置为否

swift - Swift 5 中以 NSException 类型的未捕获异常终止

swift - 自定义单元格中的 didSelectRowAt 不执行任何操作