1
votes

I have a UITableView with 6 sections and custom static cells in each - all created within IB (using Storyboard).

Three of these sections have multiple cells with nothing more than a label in them. The user will select one or more of the cells in each of these 3 sections. I want to capture the text of each selected cell's label.

I have used [self.tableview indexPathsForSelectedRows] to create an array of indexPaths. I can get the selected section and row by iterating through the array with indexPath.section and indexPath.row.

I do not know how to get the label in the selected cell. Can this be done or should I just create another array with all possible text items and use the indexPath.section and indexPath.row to pick out the desired text?

1

1 Answers

-1
votes

Can't you just do the following for each indexPath?

UITableViewCell* cell = [tableView cellForRowAtIndexPath:myIndexPath];
NSString* myText = cell.textLabel.text;