Gaiters, Despite the fact that your answers did not solve my problem directly, it helped me narrow it down.
I have a text view in each cell and need to pass which text view was edited so that I can update the database.
In a nutshell, I set each textview tag in each cell in indexpath.row. Then I refer to this cell in the texthow.tag delegate
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"frontCell" owner:self options:nil]; cell = mainPageCell; self.mainPageCell = nil; cell.selectionStyle = UITableViewCellSelectionStyleNone; } UITextView *trackDetails; trackDetails = (UITextView *)[cell viewWithTag:22]; trackDetails.text = [[myArray objectAtIndex:indexPath.row] objectAtIndex:0]; trackDetails.delegate = self; trackDetails.tag = indexPath.row; } - (void)textViewDidEndEditing:(UITextView *)textView { NSLog(@"%d",textView.tag); UPDATE DATABASE WITH CHANGED TEXT [textView resignFirstResponder]; [self.tableView reloadData]; }
source share