• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: High Scores local to iPhone app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: High Scores local to iPhone app


  • Subject: Re: High Scores local to iPhone app
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 05 May 2009 13:16:20 -0700

On May 5, 2009, at 11:50 AM, Eric E. Dolecki wrote:
Probably only 10... however I understand that a plist can't store complex data... how would this work for pairs? Normally I'd only be able to store just a list of scores, not paired with names, correct?

A property list is composed of a relatively arbitrary collection of NSArray, NSString, NSDate, NSNumber, and NSString instances arranged pretty much however you like. So, name/score pairs are trivial to represent. Of course, if you use names as key, you can only have one score per name unless you, say, hang an array off the dictionary as a value.


Or you could create a simple class that holds your name/score tables however it wants to....

@interface MyScoreTable : NSObject <NSCoding>
{
	NSMutableArray *names;
	NSMutableArray *scores;
}
...
@end

And then implement the NSCoding methods to read/write archived versions of the names/scores.

Or you could just shove 'em all in a string:

Bob\t100\n
Fred\t120\n
Bob\t90\n
Joe\t220\n
bbum\t1000042\n

And then parse that w/a bit of "componentsSeparatedByString:" hackery. Not exactly efficient, but for only 10 items, it really matters not.

b.bum
(Who is terribly good at games, as you can see from my masterful score above)
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >High Scores local to iPhone app (From: "Eric E. Dolecki" <email@hidden>)
 >Re: High Scores local to iPhone app (From: Bill Bumgarner <email@hidden>)
 >Re: High Scores local to iPhone app (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: How remove a clip path? SOLVED
  • Next by Date: Re: How to change the case of letters
  • Previous by thread: Re: High Scores local to iPhone app
  • Next by thread: Re: High Scores local to iPhone app
  • Index(es):
    • Date
    • Thread