Refresh the entire iOS app [closed]

2019-09-20 18:17发布

I working on an app with tabs which shows info about a person in a database. In one of my tabs there is a textbox through which a user can search for a new person.

My problem is, how do I refresh all my tabs with the information from the new person?

I make a server call and get all the new info but I just don't know how to refresh the entire app. Any help would be appreciated.

Thank you

2条回答
再贱就再见
2楼-- · 2019-09-20 18:53

Post a notification when old data is invalidated and post a notification when new data is available. Make your view controllers listen for these notifications. When old data is invalidated, show a loading notification. When new data is available, update your views and clear any loading notification.

查看更多
beautiful°
3楼-- · 2019-09-20 18:55
(void)applicationDidBecomeActive:(UIApplication *)application {   \\\your code   }

Reload the data in the above function of the app delegate to refresh the data when ever the app comes to foreground. You can call this function on a button click!

查看更多
登录 后发表回答