- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //創建Window self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; //判斷要顯示的Controller //1. NSString *versionKey = (NSString *)kCFBundleVersionKey; //從Info.plst中取出版本號 NSString *version = [NSBundle mainBundle].infoDictionary[ versionKey]; //從沙盒中取出上次存儲的版本號 NSString *saveVersion = [[NSUserDefaults standardUserDefaults] objectForKey:versionKey]; //2.判斷 if ([version isEqualToString:saveVersion]) { self.window.rootViewController = [[應用程序主頁面控制器 alloc] init]; } else { [[NSUserDefaults standardUserDefaults] setObject:version forKey:versionKey]; [[NSUserDefaults standardUserDefaults] synchronize]; //顯示 self.window.rootViewController = [[引導頁控制器 alloc] init]; } [self.window makeKeyAndVisible]; return YES; }
首次打開應用是顯示引導頁
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.