How to copy TableView cell data to a NSMutable Array ?

smartsanja

New member
Jun 29, 2011
1
0
0
Visit site
I'm quite new to iphone development. I created To-Do List app using coredata. I want to add all the names from "oneHero" manageObject
to a NSMutable array (that means name1 to 1st index position of MutableArray , name2 to 2nd index position of Array)

this is my table view cellfor indexpath method
Code:
- (UITableViewCell *)tableView:(UITableView *)theTableView  cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *HeroTableViewCell = @"HeroTableViewCell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:HeroTableViewCell];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:HeroTableViewCell] autorelease];
}
NSManagedObject *oneHero = [self.fetchedResultsController objectAtIndexPath:indexPath];
NSInteger tab = [tabBar.items indexOfObject:tabBar.selectedItem];
switch (tab) {
    case kByName:
        cell.textLabel.text = [oneHero valueForKey:@"name"];
        cell.detailTextLabel.text = [oneHero valueForKey:@"secretIdentity"];
        break;
    case kBySecretIdentity:
        cell.detailTextLabel.text = [oneHero valueForKey:@"name"];
        cell.textLabel.text = [oneHero valueForKey:@"secretIdentity"];
    default:
        break;
}
    //listData = [[[NSMutableArray alloc] init]autorelease];

//if(indexPath.row==1){
       //[listData addObject: [oneHero valueForKey:@"secretIdentity"]];

 return cell;
}

Actually what I want to do is, retrieve all the names(those are location names) from my "oneHero" object and then show
those locations in a mapView.
That's why I want to copy those names in to seperate NSMutable array
or just as Strings
Can you please give me a cording help . . .
 
Last edited: