garethdn
garethdn

Reputation: 12351

The best way to create a scoreboard

I'm wondering what the best way to create a scoreboard would be. The app is a jigsaw puzzle which, when completed, stops a running stopwatch. The scoreboard will contain only a name and and a time. The time is in NSString format, m.ss.

I was thinking of creating a plist and sending the name and time to this plist. I would then sort the plist by time in ascending order. I would then print out the first 5 or 10 objects to the scoreboard. Is this possible and does it sound like the best way to approach this problem?

Apologies in advance if this question format does not suit stackoverflow.

Upvotes: 0

Views: 207

Answers (1)

elusive
elusive

Reputation: 470

This would be much easier to do in Core Data. It seems like it would be a pain to pull all the plist data then sort it each time, just to display the top 5 or 10 objects. After a while, when there are a bunch of results, performance may slow. I suppose you could sort your plist each time you save it, but Core Data is better...

Using core data you can easily filter the fetch results using NSPredicate and sorting using NSSortDescriptor. Read a tutorial on Core Data if you are not familiar. It isn't hard, you just need to understand how all the components interact. The coding itself is really simple.

Upvotes: 1

Related Questions