Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Programmer

macrumors member
Original poster
Jun 16, 2009
79
0
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!
 
Use registerDefaults to set up your initial value.

Code:
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.