有没有一种方法可以强制刷新UITableView中的单个标头? [英] Is there a way to force a refresh of just a single header in UITableView?

查看:50
本文介绍了有没有一种方法可以强制刷新UITableView中的单个标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UITableView,我想在其中强制刷新特定节头行,而不是数据行.例如,刷新第3节的标题.我知道如何重新加载整个节(标题和数据),但是能否刷新节标题?

当数据在表的一个部分中更改时,我想更新DIFFERENT部分的标题中的信息.因此,我需要获取对节标题的引用,然后刷新它.

解决方案

如果标头是自定义的UIView,则只需在UIView而不是UITableView上调用setNeedsDisplay.

I have a UITableView where I want to force a refresh of just a specific section header row, not the data rows. For example, refresh the header for section 3. I know how to reload an entire section (header plus data), but can just the section header be refreshed?

EDIT: When data changes in one section of the table I want to update information in the header of a DIFFERENT section. Therefore, I need to get a reference to the section header and then refresh it.

解决方案

If the header is a custom UIView, then you can just call setNeedsDisplay on the UIView rather than on the UITableView.

这篇关于有没有一种方法可以强制刷新UITableView中的单个标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆