I have some data in JSON format which looks like this:
{"YrMonth":201109,"StrYrMonth":"Sep-2011","Value":"49275.14"}
{"YrMonth":201110,"StrYrMonth":"Oct-2011","Value":"52087.22"}
etc...
Using NSJSONSerialization I stored this data in an array called "indicator".
When I want to use this data and display only the items with the key "Value" in a tableView, I can do it fine with:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainCell"];
cell.textLabel.text = [[indicator objectAtIndex:indexPath.row] objectForKey:@"Value"];
return cell;
}
My question is: how can I create an Array that I can use outside of cellForRowAtIndexPath with the values for each key?
For example:
An array for key "StrYrMonth" which contains only: "Sep-2011", "Oct-2011", etc...
An array for key "Value" which contains only: "49275.14", "52087.22", etc...
What I would ultimately like to do is use the "Value" array to plot a line in CorePlot and the "StrYrMonth" array to define de x-Axis labels of the graph.
Thanks in advance for your help!