更新时间:2023-12-04 09:56:40
你可以创建一些 bool
变量来检查这是第一个开始还是另一个。存储此 bool
的***位置是NSUserDefaults。好吧,如果这是第一次启动,那么显示你的LoginViewController,如果没有 - 执行常规代码:
You can create some bool
variable for checking is this a first start or another. The best place to store this bool
is NSUserDefaults. Well, if this is a first start then show your LoginViewController, if not - execute regular code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIViewController *startVC = nil;
if (isFirstLaunch){
startVC = [[[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil] autorelease];
}
else{
startVC = [[[WorkspaceViewController alloc] initWithNibName:@"WorkspaceView" bundle:nil] autorelease];
}
navController = [[UINavigationController alloc] initWithRootViewController:startVC];
[self.window makeKeyAndVisible];
[self.window addSubview:navController.view];
return YES;
}