Wednesday, 14 August 2013

Get text of all selected rows

Get text of all selected rows

I have a UITableView and I am trying to get the text of all the selected
rows when a button is pressed. Here's what I have so far:
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *selectedCell = [tableView
cellForRowAtIndexPath:indexPath];
[selectedRows addObject:selectedCell.textLabel.text];
}
selectedRows is an array.
Here is my button press function where I need access to the checked row
titles:
- (IBAction)selectList:(id)sender {
NSLog(@"%@", selectedRows);
}
This doesn't work for me because if a user unchecks a row and then clicks
the submit button - it is not reflected in the array. I would appreciate
some help with this. thanks.

No comments:

Post a Comment