开发者

iphone - Problem loading a table view inside a viewcontroller

I have开发者_高级运维 a TabBarController, which consists of three tabs, one of which is the settings tab. I am trying to sync the settings of the app with NSUserDefaults + settings.bundle and the in app settings that I have in the settings tab. When I change the settings.bundle settings, I use an observer and it sets properties for the in app settings.

The issue I am running into is, if I enter the app, go to the Settings Tab, then exit the app, go to the Settings bundle settings, change a setting, and go back to the settings tab, the setting does not refresh, because table.reloadData is not called then. I tried calling it explicitly from my AppDelegate when the observer is called, but I see no change on the page.

Has anyone encountered a problem like this before? How do I refresh the table / view?


You should use applicationWillEnterForeground: in your app delegate. Maintain a reference to the settings view controller from your tab bar controller and then have your app delegate call a method in your tab bar controller, then settings view controller, from there.


In your settings view controller's viewDidAppear method, call [self.tableView reloadData]. This will reload the data in the table view every time your settings screen appears.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜