Tworzenie pierwszego kontrolera uruchamiania
Próbuję utworzyć „stronę konfiguracji początkowej”, która jest wyświetlana, jeśli aplikacja jest uruchamiana po raz pierwszy na urządzeniu.
Zrobiłem to tak:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
{
NSLog(@"not first launch");
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
else
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"first launch");
}
}
Teraz chcę utworzyć kontroler widoku i nacisnąć ten kontroler widoku, jeśli aplikacja jest uruchamiana po raz pierwszy.
Co muszę zrobić?