How to tell if the app is the first boot, when the first boot, loading the boot page, etc.
Here is my solution:
1. Found in "AppDelegate.h"-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) Launchoptions method, add the following code:
if(! [[Nsuserdefaults Standarduserdefaults] Boolforkey:@"everlaunched"] {[[Nsuserdefaults standarduserdefaults] setbool:yes forkey:@"everlaunched"]; [[Nsuserdefaults Standarduserdefaults] setbool:yes forkey:@"Firstlaunch"];}Else{[[Nsuserdefaults standarduserdefaults] setbool:no forkey:@"Firstlaunch"];}
At the first boot, key @ "everlaunched" is not assigned and is set to Yes. @ "Firstlaunch" is set to YES.
In other parts of the program, use the following code to determine:
if([[Nsuserdefaults standarduserdefaults] Boolforkey:@"Firstlaunch"]) { //here to determine whether the first timeHdisplayview*HVC = [[Hdisplayview alloc]initwithframe:cgrectmake (0,0, Mainscreen_width, Mainscreen_height)]; [Self.window.rootViewController.view ADDSUBVIEW:HVC]; [UIView animatewithduration:0.25animations:^{hvc.frame= CGRectMake (0,0, Mainscreen_width, mainscreen_height); }]; }
@ "Firstlaunch" will be set to NO.
Determine if the app is the first time it starts