How can I keep user scores inside my iPhone App?
<p>I'm working on a game, but I'm having trouble trying to <strong>set the scores and keeping them in a table</strong>. What I've done is I've made it to where my <strong>game runs a method at the end of every level to check whether the score should be saved or not</strong>, but I'm not sure how to save them and sort them from <strong>highest to lowest</strong>.</p>

<p>This is what my table should include: </p>

<ul>
<li><strong>#:</strong></li>
<li><strong>Name:</strong></li>
<li><strong>Score:</strong></li>
<li><strong>Time:</strong></li>
</ul>

<p>In that order, I've also sorted it to only include 14 rows.</p>

<p>What I have on the XIB is a scrollview with an image inside that shows the chart and the top fields <strong>[#: , Name: , Score: , Time: ]</strong>. I'm not sure how I should display the text for the fields though.</p>

<p>I would greatly appreciate if someone could explain to me <strong>how I would go about making this</strong> and keeping up with the sorting and everything to display them in the table.</p>

<p><img src="http://i.stack.imgur.com/hkBCo.png" alt="Scores"></p>

<p>Here's my code so far, but it's subject to change, so feel free to correct me where I'm wrong or provide me with a different solution.</p>

<p>Thanks in advance!</p>

<pre><code>-(void) mGameScoreSelected {
    if (![sGameScoresScore isEqualToString:@""]) {
        sScoresRowCurrent = [NSString stringWithFormat:@"%i | %@ | %@ | %@", iGameScoresPlace,sGameScoresName, sGameScoresScore, sGameScoresTime];

        kLog(@"%@", sScoresRowCurrent);
    }
}

-(void) mGameScoreDetermine {
    bGameScoreSetFinished = TRUE;

    for (int x = 0; x &lt;= 3*14; x++) {
        if ([sGameScoresScore intValue] &gt; [sScoresScores [x-1] intValue] &amp;&amp; bGameScoreSetFinished == TRUE) {
            [self mGameScoreSelected];
            bGameScoreSetFinished = FALSE;
        } else {
            sGameScoresScore = @"";
            sGameScoresTime = @"";
        }
    }
}

-(void) mGameScoreSet {    
    sGameScoresScore = [NSString stringWithFormat:@"%i", iGameScoreCurrent];
    sGameScoresTime = [NSString stringWithFormat:@"%i", iGameTimeTotal - iGameTimeCurrent];

    kLog(@"Score: %@", sGameScoresScore);
    kLog(@"Time: %@", sGameScoresTime);

    [self mGameScoreDetermine];
}

-(void) mGameEnded {
    [self mGameScoreSet];
}
</code></pre>
