Refresh the entire iOS app [closed]

房东的猫 提交于 2019-12-16 18:05:40

问题


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


回答1:


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.




回答2:


(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!



来源:https://stackoverflow.com/questions/12239260/refresh-the-entire-ios-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!