I want to show the “intro” nib i made only at first app launch.
I was using the following code in my viewDidLoad but it seems to do nothing (even in ViewWillAppear). I tried to clean, remove the app from simulator and device and build again but nothing happened.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (![defaults objectForKey:@"firstRun"]){
IntroViewController *intro = [[IntroViewController alloc] initWithNibName:nil bundle:nil];
intro.modalTransitionStyle = UIModalTransitionStyleCoverVertical ;
[self presentModalViewController:intro animated:YES];
[intro release];
[defaults setObject:[NSDate date] forKey:@"firstRun"];
}
[[NSUserDefaults standardUserDefaults] synchronize];
I also tried to show a little UIAlertView at first launch, and it works! Am i failing to load the nib?
EDIT
I forgot to say it’s a tab Bar based app and i’ve some code in my app delegate to highlight rows at the first three sessions of the app.
Any help appreciated!
Ok, add the following code and it should work:
Apparently, in this case, you can’t load a second view right after your view is loaded (viewdidload)
Therefor you just set a small delay before loading your second view.