I have an array of dictionaries loaded from a plist (below) called arrayHistory.
<plist version="1.0">
<array>
<dict>
<key>item</key>
<string>1</string>
<key>result</key>
<string>8.1</string>
<key>date</key>
<date>2009-12-15T19:36:59Z</date>
</dict>
...
</array>
</plist>
I filter this array based on 'item' so that a second array, arrayHistoryDetail has the same structure as arrayHistory but only contains e.g. 'item's equal to '1'. These detail items are successfully displayed in a tableView.
I then want to select an item from the tableView, and delete it from the tableView data source, arrayHistoryDetail (line 2 in the code below) - works, then I want to delete the item from the tableView itself (line 3 in the code below) - also works.
My problem is that I also need to delete it from the original arrayHistory, so I tried the following: created a temporary dictionary as an ivar:
NSMutableDictionary *tempDict;
@property (nonatomic, retain) NSMutableDictionary *tempDict;
Then my thinking was to make a copy in line 1 and remove it from the original array in line 4.
1 tempDict = [arrayHistoryDetail objectAtIndex: indexPath.row];
2 [arrayHistoryDetail removeObjectAtIndex: indexPath.row];
3 [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
4 [arrayHistory removeObject:tempDict];
Didn't work. Could someone please guide me in the right direction. I'm thinking that tempDict is a pointer and that removeObject needs a copy? I don't know.
Thanks.