5 iphone reload uitabbarcontroller uitableview
我正在实现一个Notes管理器应用程序,它在tabBar中有一个tableView,其中显示了其注释的主要信息.访问一个注释时,您可以编辑其属性.在tabBar的一个按钮中,您可以选择在tableView中显示注释的方式.
我遇到的问题是我不知道如何从子控制器或tabBar的其他控制器重新加载数据.我不知道如何从它们引用tableView,所以我可以使用reloadData从它们更新TableView的信息.
我是iPhone开发的新手......任何帮助都会非常感激.
你应该试试NSNotificationCenter.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomething:) name:@"doSomethingNotification" object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"doSomethingNotification" object:nil];
Run Code Online (Sandbox Code Playgroud)
MVC 模式在这里会有所帮助,
只要您不断使用所需的信息更新您的模型,并且您的控制器正在从该模式进行更新。当您在视图之间向后滑动时,您最终会自动更新视图。
这样您就可以调用重新加载数据方法,它们将得到更新。
[tableviewController.tableview reloadData];
Run Code Online (Sandbox Code Playgroud)
这是您访问重新加载数据消息的方式。
| 归档时间: |
|
| 查看次数: |
32712 次 |
| 最近记录: |