NSNotificationCenter 和 UITabBar 应用程序
这是我的问题:
我有一个应用程序。它基于四个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将
[tableView reloadData]
放入 ViewController 的-(void)viewDidAppear:(BOOL)animated
方法中即可。Simply put a
[tableView reloadData]
into your-(void)viewDidAppear:(BOOL)animated
method of the ViewController.