I’m loading icons from an XML file in to an NSMutableArray using the following:
NSArray *iconItems = [doc nodesForXPath:kName_icon error:nil];//Root node
for (CXMLElement *iconItem in iconItems)
{
NSArray *iconTempArray = [iconItem elementsForName:kName_url];
for(CXMLElement *urlTemp in iconTempArray)
{
arryTableAllIcons = [[NSMutableArray alloc] init];
[arryTableAllIcons addObject:[NSString stringWithFormat:@"%@", urlTemp.stringValue]];
NSLog(@"Icon Found %@",urlTemp.stringValue);
break;
}
I’m trying to display this in my table through the following: (this is in the -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath )
cell.textLabel.text = [arryTableAllIcons objectAtIndex:indexPath.row];
The count seems to work as I have the correct number of cells, but empty cells in the table and 1 with the last icon found text in
The count is just: `return [arryTableAllIcons count];`
And my NSLog brings back the correct text
2011-11-07 10:30:23.692 Del Search[2791:f203] Icon Found guideDogs_off.png
2011-11-07 10:30:23.692 Del Search[2791:f203] Icon Found WheelchairAssist_off.png
2011-11-07 10:30:23.739 Del Search[2791:f203] Icon Found walk_off.png
2011-11-07 10:30:23.740 Del Search[2791:f203] Icon Found DisabledWc_off.png
2011-11-07 10:30:23.741 Del Search[2791:f203] Icon Found hearingaid_off.png
2011-11-07 10:30:23.741 Del Search[2791:f203] Icon Found loop_off.png
2011-11-07 10:30:23.742 Del Search[2791:f203] Icon Found carpark_off.png
2011-11-07 10:30:23.742 Del Search[2791:f203] Icon Found dropcounter_off.png
2011-11-07 10:30:23.743 Del Search[2791:f203] Icon Found staff_off.png
2011-11-07 10:30:23.743 Del Search[2791:f203] Icon Found Buggy_off.png
So I must just be adding the array wrong!

Any help will be really appreciated
I think the problem is that you’re declaring the array inside the “For” loop. In this way you’re instantiating it every time the cycle repeats