Quote:
Originally Posted by Domele
Wrap the scores in NSNumbers and store them in an array. Then use NSUserDefaults to save them.
Code:
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setObject:yourArray forKey:yourHighScoreArrayKey];
[prefs syncronize];
NSArray *highScoreArray = [prefs objectForKey:yourHighScoreArrayKey];
|
Hey Domele, good to see you again, been learning a lot watching tuts on youtube.
Here is my question, what would be the best way to simplify that code to produce two utility functions like:
saveUserPreferences(scores,"scoreboard")
scores = loadUserPreferences("scoreboard")
and where to put that library for reuse in future projects? Should I create a utils.h/m file and include them in my projects whenever I need that functionality? What would it be your approach to simplify stuff?