So, the App Delegate class - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions will be called only at the first entrance to the application. Then it will call - (void)applicationDidBecomeActive:(UIApplication *)application .
If your iphone iOS is 4.0 or later, when the user clicks the home button, he first calls - (void)applicationWillResignActive:(UIApplication *)application , then - (void)applicationDidEnterBackground:(UIApplication *)application .
Then the application will start in the background until the user kills it. When the user starts the application again, he will first call - (void)applicationWillEnterForeground:(UIApplication *)application , then - (void)applicationDidBecomeActive:(UIApplication *)application .
In connection with your question, you should call either applicationWillEnterForeground: or applicationDidBecomeActive: to reload your data. Although Apple suggests using applicationDidBecomeActive: in the xcode comment of these methods applicationDidBecomeActive: to restart suspended tasks and / or update the user interface; and in applicationWillEnterForeground: you can undo the changes you made when entering the background.
So, to make browsing easier, I put a number tag in each method. Here when the method is called.
0 application:(UIApplication *)application didFinishLaunchingWithOptions: 1 applicationDidBecomeActive: 2 applicationWillResignActive: 3 applicationDidEnterBackground: 4 applicationWillEnterForeground:
First enter the application: call 0, then 1;
Press the home button: call 2, then 3;
Button for double pressing the house (multitasking): call 2;
Enter the application again: call 4, then 1;
sbs
source share