iOS 引导页面启动一次

#import "AppDelegate.h"



@implementation AppDelegate



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.

    self.window.backgroundColor = [UIColor whiteColor];

    

    //增加标识,用于判断是否是第一次启动应用...

    if (![[NSUserDefaults standardUserDefaults] boolForKey:@"everLaunched"]) {

        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"everLaunched"];

        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstLaunch"];

    }

    

    

    

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) {

        ViewController *appStartController = [[ViewController alloc] init];

        self.window.rootViewController = appStartController;

    }else {

        //NextViewController *mainViewController = [[NextViewController alloc] init];

        //self.window.rootViewController=mainViewController;

    }

    [self.window makeKeyAndVisible];

    return YES;

}

 

你可能感兴趣的:(ios)