iPhoneでゲームアプリを作成する時に、
ハイスコアの保存と表示は必須の機能。

それを実装するのに、下記記事が参考になります。

http://iphone-dev.g.hatena.ne.jp/kusakari/comment?date=20080929

(以下引用:)

// Saves the user's score in the application preferences
- (void)saveScore {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* name = [defaults stringForKey:kUserNameDefaultKey];
NSDate* date = [NSDate date];
NSMutableArray* scores;
NSMutableString* string;
unsigned i;
NSDictionary* dictionary;

//Dismiss text field
[_textField endEditing:YES];
[_textField removeFromSuperview];

//Make sure a player name exists, if only the default
if(![name length])
name = @"Player";

//Update the high-scores in the preferences
scores = [NSMutableArray arrayWithArray:[defaults objectForKey:kHighScoresDefaultKey]];
[scores addObject:[NSDictionary dictionaryWithObjectsAndKeys:name, @"name", [NSNumber numberWithUnsignedInt:_score], @"score", date, @"date", nil]];
[scores sortUsingDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"score" ascending:NO] autorelease]]];
[defaults setObject:scores forKey:kHighScoresDefaultKey];

//Display high-scores in status texture
string = [NSMutableString stringWithString:@" HIGH-SCORES\n"];
for(i = 0; i < MIN([scores count], 10); ++i) {
dictionary = [scores objectAtIndex:i];
[string appendFormat:@"\n%s%i. %@ (%@ Pts)", ([[dictionary objectForKey:@"date"] isEqualToDate:date] ? "> " : " "), i + 1, [dictionary objectForKey:@"name"], [dictionary objectForKey:@"score"]/*, [[dictionary objectForKey:@"date"] descriptionWithCalendarFormat:@"%m/%d %I:%M %p" timeZone:nil locale:nil]*/];
}
[_statusTexture release];
_statusTexture = [[Texture2D alloc] initWithString:string dimensions:CGSizeMake(256, 256) alignment:UITextAlignmentLeft fontName:kFontName fontSize:kScoreFontSize];
_state = kState_StandBy;

//Render a frame
[self renderScene];
}



アプリごとにオブジェクトの保存を実現できる
ユーザー・デフォルトを利用するパターンですね。

他にファイルを利用する方法もあるので、
また別の機会にご紹介します。