任何人都有这方面的基础教程吗?
答案 0 :(得分:1)
使用NSArray保持分数。并使用NSUserDefaults
保存/加载它如果您有固定数量的级别 - 请使用NSArray保留。更改数组值时:
-(void) saveScore
{
NSUserDefaults *settings = [NSUserDefaults standartUserDefaults];
[settings setObject: myScoreArray forKey:@"my scores"];
[settings synchronize];
}
加载数组:
-(void) loadScores
{
NSUserDefaults *settings = [NSUserDefaults standartUserDefaults];
myScoreArray = [settings objectForKey:@"my scores"];
//also check if myScoreArray in nil - first launch
}