Iphone 如何将TableView单元格数据复制到NSMutable数组?
我对iphone的开发还很陌生。我使用coredata创建了待办事项列表应用程序。 我想将“oneHero”manageObject中的所有名称添加到NSMutable数组中(这意味着name1到MutableArray的第一个索引位置,name2到数组的第二个索引位置) 这是我的indexpath方法的表视图Iphone 如何将TableView单元格数据复制到NSMutable数组?,iphone,objective-c,ios,uitableview,nsmutablearray,Iphone,Objective C,Ios,Uitableview,Nsmutablearray,我对iphone的开发还很陌生。我使用coredata创建了待办事项列表应用程序。 我想将“oneHero”manageObject中的所有名称添加到NSMutable数组中(这意味着name1到MutableArray的第一个索引位置,name2到数组的第二个索引位置) 这是我的indexpath方法的表视图 - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath
- (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;
}
实际上,我想做的是,从我的“oneHero”对象中检索所有名称(这些是位置名称),然后在地图视图中显示这些位置。这就是为什么我想将这些名称复制到单独的NSMutable数组中,或者复制为字符串
你能给我一个真诚的帮助吗