NSNotificationCenter 和 UITabBar 应用程序

发布于 2024-11-27 05:40:22 字数 346 浏览 3 评论 0原文

这是我的问题:

我有一个应用程序。它基于四个 UITabBar 视图。在视图 3 上发生了一些事情,通知被发送到 NSNotificationCenter。视图 1 中有一个观察者,它等待所述通知,首先从本地文件加载一些数据(这些数据在发布通知之前保存到文件中),然后更新 UITableView -> 。 [TableView 重新加载数据]。所以...我将 nslog 添加到观察者和通知中,它们会触发,但是当我切换到视图 1 时,UITableView 不会更新(当我重新启动应用程序时,一切都很好)。

会出现什么问题?

顺便提一句。视图 1 的更新应该在视图 3 当前存在时进行。

任何帮助表示赞赏!

Here's my problem:

I have an app. It's based on four UITabBar views. On view 3 something happens and notification is being sent to NSNotificationCenter. There's an observer in view 1, which waits for said notification to first load some data from a local file (which were saved to the file before posting the notification) and then update a UITableView -> [TableView reloaddata]. So... i added nslogs to the observer and notification and they fire, but the UITableView is not updated when i switch to view 1 (when i restart the app, all is fine).

What can go wrong?

Btw. updating of view 1 is supposed to happen while view 3 is currently present.

Any help is appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如梦亦如幻 2024-12-04 05:40:23

只需将 [tableView reloadData] 放入 ViewController 的 -(void)viewDidAppear:(BOOL)animated 方法中即可。

Simply put a [tableView reloadData] into your -(void)viewDidAppear:(BOOL)animated method of the ViewController.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文