Conor Taylor
Conor Taylor

Reputation: 3108

Making a local highscore list iPhone

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

Answers (2)

Timur Mustafaev
Timur Mustafaev

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

agilityvision
agilityvision

Reputation: 7931

Put them in an NSArray, you can sort them using any of the half dozen methods NSArray has for that.

Upvotes: 1

Related Questions