I have an NSString that gets a new value everytime a cell is clicked i want to add this value to an NSMutableArray, I have tried the following [NSMutableArray addObject:NSString] but this adds the string at the first index value of the NSMutableArray and on click of the next cell it replaces the value that was previously stored. I want to save all the values. How can it be done?

```
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

 UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];

NSIndexPath *tableSelection = [listingSet indexPathForSelectedRow];

if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
    cell.accessoryType = UITableViewCellAccessoryNone;

    [SelectedFiles removeObject:ID];
    NSLog(@"++++++Titlesss %@",SelectedFiles);

    [listingSet deselectRowAtIndexPath:tableSelection animated:YES];
} else { 

    cell.accessoryType = UITableViewCellAccessoryCheckmark;

          ID = [NSString stringWithFormat:@"%@",[[ParsedData valueForKey:@"ID"]objectAtIndex:indexPath.row]];

                   [SelectedFiles insertObject:ID atIndex:0];
    NSLog(@"%@",ID);
        NSLog(@"%@",SelectedFiles);

            [listingSet deselectRowAtIndexPath:tableSelection animated:YES];
}

}

```

This does not seem to work.

EDIT: I read somewhere that my data is being saved on the first index of the array so i would need to increment the index path of the array everytime i save data in it but i am unable to figure out how.