I have an application with a tab bar with several tabs with user content. When each view controller is loaded, the viewDidLoad method makes HTTP requests to the server to retrieve the data, and then populates its view accordingly. However, as soon as all the data is loaded, the view remains the same (unless the view controller is unloaded and restarted).
Many other user-content applications have similar behavior, except that each view reloads if the application goes into the background and then returns to the forefront. That is, when the user switches between different tabs while the application is active, the content will not be automatically updated. If the user "terminates" the application and then returns to it later, the views will be reloaded.
Are there standard application development methods to behave this way? In particular, I am wondering if there are any UIKit subtleties that I can use to update my views on "reloading" the application.
Otherwise, I suggest that a simple approach is to have each register of the view controller for notifications in viewDidLoad and listen to the application coming in the foreground. Then the controller can respond to each notification, reloading its data.
source
share