Reputation: 3108
I need to make a local highscore list with 10 entries for my game. I have neen looking at NSDictionary examples but they are all pretty bad! Could anyone quickly show me how to firstly order the top ten scores, then store them, and then display them (in order)???
Thanks
Upvotes: 0
Views: 125
Reputation: 4929
Create class "Score" with properties:
NSString name
(name of player) , and double score
(player's score).
Then add instances of this class to one NSArray and put this NSArray to NSUserDefaults. And when you need them, just get this NSArray from NSUserDefaults. That's it. I think :)
Upvotes: 3
Reputation: 7931
Put them in an NSArray, you can sort them using any of the half dozen methods NSArray has for that.
Upvotes: 1