Store score at the time of completing game & get data on HighScore button press in iphone
<p>I have done this code to store score.</p>

<p>But this is giving me the last added score only, not storing data every time on new index.</p>

<pre><code>-(IBAction)btnSaveScore:(id)sender
{
    if(!dictWinData)
        dictWinData = [[NSMutableDictionary alloc] init];

    array = [NSMutableArray arrayWithObjects:txt_EnterName.text,
                                             [NSString stringWithFormat:@"%i",iTap], nil];

    int increment = 0;

    NSLog(@"array data is:--&gt; %@",array);

    for (int intWinData = 1; intWinData &lt; [array count]; intWinData++)
    {
        [dictWinData setObject:array forKey:[NSString stringWithFormat:@"NameScore%d",increment]];
        increment++;
    }
}
</code></pre>

<p>If any mistake is there in my code then please let me guide for this.</p>

<p>Is there anyother way to store the data..?</p>

<p>Is <code>NSUserDefaults</code> helpful to store &amp; display data...?</p>

<p>How to use <code>NSUserDefaults</code> to store &amp; retrive data.</p>

<p>Thanks.</p>
