I have got a table view which is populated by json webservice url.I am using “UITableViewCellAccessoryCheckmark” for tick mark. when user multiple select the tableview I want all the selected row data to be stored in a single variable.Could you guys help me out. below is the code.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
if ([self.arForIPs containsObject:indexPath]) {
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
}
else {
[cell setAccessoryType:UITableViewCellAccessoryNone];
}
NSString *imagefile1 = [media1 objectAtIndex:indexPath.row];
cell.textLabel.text=[story objectAtIndex:indexPath.row];
cell.detailTextLabel.text=[descriptiondesc objectAtIndex:indexPath.row];
cell.detailTextLabel.numberOfLines=2;
//cell.detailTextLabel.backgroundColor=[UIColor clearColor];
img=[UIImage imageNamed:@"icon.png"];
cell.imageView.image=img;
NSLog(@"BOOMMMM:%@",pileup);
return cell;
}

If you’ve enabled multiselection you should be able to use UITableView’s
indexPathsForSelectedRowsto get all the indices of the selected rows. With this you can refer back to your original data downloaded from the server and get the strings you need.You can use it within
tableView:didSelectRowAtIndexPath:to build a string of all the currently selected rows.EDIT:
To store a few pieces of associated data together you can use an NSDictionary (or NSMutableDictionary if you need to edit it after creation).
For example for your code, to store all the data for one row:
or you could create it straight into a regular NSDictionary, see here: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsdictionary_Class/Reference/Reference.html