I'm trying to start a different ViewController when a BOOL in NSUserDefaults isn't set.. When the "RegistreerView" is loaded the screen stays white? What do i do wrong? How can i start a different ViewController when starting my application.
I use the following code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL *geregistreerd = [defaults objectForKey:@"geregistreerd"];
if(geregistreerd){
self.window.rootViewController = self.viewController;
} else {
self.window.rootViewController = self.registreerView;
}
[self.window makeKeyAndVisible];
return YES;
}
Theoretically you may not be instantiating your nib, as I don't see anywhere in this method that creates it above. If not, you could try the following:
SomeView *yourView = [[SomeView alloc] initWithName:@"YourViewController" bundle:nil];
self.window.rootViewController = yourView;
[yourView release];
Replacing SomeView
and YourViewController
with the appropriate names.