How do I create a one-time pop up at the start of my application?

Discussion in 'iOS Development' started by davidlansalot, Mar 21, 2009.

  1. davidlansalot

    davidlansalot New Member

    Joined:
    Oct 29, 2007
    Messages:
    213
    Likes Received:
    0
    Device:
    2G iPod touch
    I was wondering how I could make a message pop-up when it is the users first time to open the application explaining how to use the app. thanks
  2. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    Not sure if this is the best way, but it's what i would use.
    Save a bool appOpened in NSUserDefaults.
    Default it to FALSE, then save it as TRUE with NSUserDefaults in applicationDidFinishLaunching.
  3. davidlansalot

    davidlansalot New Member

    Joined:
    Oct 29, 2007
    Messages:
    213
    Likes Received:
    0
    Device:
    2G iPod touch
    Code:
    if (![@"1" isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:@"FirstAlert"]]) {
    		[[NSUserDefaults standardUserDefaults] setValue:@"1" forKey:@"FirstAlert"];
    		[[NSUserDefaults standardUserDefaults] synchronize];
    //Your alert here
    This worked for me
  4. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    is that is like boolForKey too? Never mind, you are using a string for it.
  5. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    You don't need to presabe your bool an anything, it will automatically return NO (false (0)) if it hasn't been set. When you dismiss the popup, set the bool for true.

    Also, don't use a string, as there's in sense making the phone check for string equality (it has to go through char by char, performing a check per letter).

Share This Page