表视图节标题未更新
ViewA 列出按部分分组的数据,当您选择一行时,您将转到 ViewB。在可能编辑多个字段后,您可以使用后退按钮返回到 ViewA。如果在 ViewB 中编辑用作节标题的属性,则新值不会显示在 ViewA 中,除非您退出并返回其中。
我能找到解决此问题的唯一方法是将 fetchedResultsController 设置为 nil,然后设置 [self.tableView reloadData],这会使 FRC 重新加载。但这似乎效率极低。有更好的办法吗?
ViewA lists data grouped by section, and when you select a row you go to ViewB. After potentially editing several fields, you use the back button to go back to ViewA. If the attribute used as the section header is edited in ViewB, the new value doesn't show up in ViewA unless you back out of it and go back into it.
The only way I can find to fix this is to set fetchedResultsController to nil and then [self.tableView reloadData], which makes the FRC reload. But this seems horribly inefficient. Is there a better way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不管你相信与否,
[theTableView_A reloadData]
是执行此操作的首选和建议方法。这看起来效率低下,但它确实是确保所有标签、单元格、页眉、页脚、间距等正确布局的唯一方法。话虽如此...有这样的事情:
它可以处理仅已更改的部分的更新 - 这可能会满足您的需要。
另一方面,
reloadData
在幕后进行了大规模优化,并缓存单元格和许多其他对象,以便不必重新计算和重绘不应该的内容。Believe it or not,
[theTableView_A reloadData]
is the preferred and suggested way to do this. It seems inefficient but it really is the only way to ensure that all labels, cells, headers, footers, spacing, etc is correctly laid out.Having said that... there are things like:
which can deal with updating only sections that changed -- which may do what you need.
On the other hand,
reloadData
is massively optimized behind the scenes and caches cells and many other objects in order to not have to recalculate and redraw things it shouldn't.