2012-05-11 3 views
0

Je voudrais savoir comment puis-je copier et afficher les contacts sélectionnés d'un tableau à un autre tablview. J'ai une liste o contacts dans une tableview. J'ai l'option des contacts multiselect. quand je clique sur fait (après sélection) j'ai besoin de copier les contacts sélectionnés à une autre tableview. Quelqu'un peut-il me guider comment puis-je y parvenir.Copier les contacts sélectionnés vers d'autres UITableView IPhone

Un exemple d'exemple ou un code sera très utile.

Merci d'avance.

Répondre

2

Vous devez avoir une source de données pour votre première tableview. si u peut utiliser méthode DidSelectRowAtIndex, 1) obtenir indexpath.row et objet de copie à partir de la source de données spécifiée à indexpath.row à un nouveau réseau (qui deviendra source de données pour ur deuxième tableview

comme ci-dessous:.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
//customArray is datasource for this tableview 
NSString *item= [self.customArray objectAtIndex:indexPath.row]; 
//arr is datasource for second tableview 
    [arr addObject:item]; 
} 

espère que cela aide.

0
lowerLblItem_Unit_Cost.text = [NSString stringWithFormat:@"%@", [delegate.addItem_UnitCost objectAtIndex:indexPath.row]]; 
    lowerLblItem_Unit_Cost.backgroundColor = [UIColor clearColor]; 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
//customArray is datasource for this tableview 
NSString *item= [self.customArray objectAtIndex:indexPath.row]; 
//arr is datasource for second tableview 
    [arr addObject:item]; 

or // you can use your own label 

lowerLblItem_Unit_Cost.text = [NSString stringWithFormat:@"%@", [delegate.addItem_UnitCost objectAtIndex:indexPath.row]]; 
    lowerLblItem_Unit_Cost.backgroundColor = [UIColor clearColor]; 

}