first high score

Discussion in 'iOS Programming' started by Programmer, Oct 2, 2009.

  1. Programmer macrumors member

    Programmer

    Joined:
    Jun 16, 2009
    #1
    I am making a game were I have an NSInteger keeping my score. When you lose I want it to compare your score to the high score and if its higher it will save your high score the only problem is that the first time you ever play the game the high score is set to nothing so there is nothing for the score to compare with until you've set the high score to something and if I set the high score to zero in the viewdidload method it would reset the NSUserDefualt I have my score saved as every time you open the app.

    Help Please!
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Use registerDefaults to set up your initial value.

    Code:
    [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];
     
  3. Programmer thread starter macrumors member

    Programmer

    Joined:
    Jun 16, 2009

Share This Page