How to show an UIAlertView (Or UIView) at the first launch of an Application?

I would like to know how to show an UIAlertView or a UIView ONLY at the first launch of my application.

Thanks.

Answers


Use NSUserDefaults to store a BOOL, like so:

-(void) showFirstRunAlerts {

    BOOL ranBefore = [[NSUserDefaults standardUserDefaults] boolForKey:@"RanBefore"];

    if (!ranBefore) {
        UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"Message title."
                          message:@"Your message."
                          delegate:self
                          cancelButtonTitle:@"Thanks!"
                          otherButtonTitles:nil];
        [alert show];
        [alert release];

        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RanBefore"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
}

Need Your Help

Windows 7 style Dropshadow in borderless form

c# .net winforms user-interface windows-7

Short Version: Goal: A deep, dark, Windows 7 dropshadow in borderless WinForm in C# Known existing solutions 1: Simple XP-style dropshadow using CreateParams. Problem: To weak, to light, to

I have to test Java

java methods main

I was told in my class that I have to write and test my code in the main method, I wrote it, but I dont know how to test it. How I am supposed to test my methods? I am supposed to take user input,...