Access problem with NSMutableArray
- by pbcoder
Hi, my problem is that I can't access my NSMutableArray in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {}.
I create my NSMutableArray here:
nodes = [xmlDoc nodesForXPath:@"/xml/items/item/short_desc" error:nil];
if (nodes != nil && [nodes count] >= 1) {
for (int i = 0; i < [nodes count]; i++) {
CXMLElement *resultElement = [nodes objectAtIndex:i];
result = [[[[resultElement attributeForName:@"data"] stringValue] copy] autorelease];
[short_desc addObject:result];
}
}
and I can print out the content of short_desc everywhere with:
NSLog([short_desc objectAtIndex:0]);
but not in:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
.....
NSString *date = [name objectAtIndex:0];
labelDate.text = date;
.....
return cell;}
if I use:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
.....
NSString *date = @"text...";
labelDate.text = date;
.....
return cell;}
it works correctly.
ANY SOLUTION FOR THIS PROBLEM???