views:

159

answers:

3

Hello, I'm trying to make a local high scores board for my app, but with no success till now. I searched anywhere for a local high score board code but didn't found any. What is the best why to write such a thing?

If you can please post example code.

Thanks.

A: 

A sorted array of structures, persistent on disk?

Pavel Radzivilovsky
I dont know how to do it. Please give a code example or a explanation.Thanks again.
Alon Ezer
Read up on the NSMutableArray class: http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html . You'll want to place your scores in something like that, then use one of the -sortUsing... methods to sort from high to low.
Brad Larson
+2  A: 

A very easy way, assuming the data set is small, would be to store an NSArray in the NSUserDefaults.

If the data set is larger you could use CoreData or even just a file created with an NSKeyedArchiver.

jessecurry
A: 

You may want to use this post for starting off with file handling to make your data persistent.

Prashant