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)
这是我的表层观点——指数方法
- (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 . . .