title: saving text entered in a text box placed inside a dynamic table
body: <p>i'm new to iOS programming, i want to save the text entered inside a text box placed inside a dynamic table cell where the table cell contents are like accordion.</p>
  
  <p>in view controller table view with 3 dynamic prototype cells are used each cell is named as header,regular and selected respectively and in view controller i used the following code</p>
  
  <pre><code> -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  UITableViewCell * cell = nil;
  
  switch (indexPath.row) {
      case 0:
      {
          cell = [tableView dequeueReusableCellWithIdentifier:@"Header"];
      }
          break;
      default:
      {
          NSArray * innerData = [self.data objectAtIndex:indexPath.row - 1];
          if(indexPath.row == self.selectedIndex)
          {
              SelectedCell * tmpCell = (SelectedCell *)[tableView dequeueReusableCellWithIdentifier:@"Selected"];
              [tmpCell.label1 setText:[NSString stringWithFormat:@"%@", [innerData objectAtIndex:0]]];
  
              cell = tmpCell;
               tmpCell.textLabel.numberOfLines=2;
  
          }
          else
          {
              RegularCell * tmpCell = (RegularCell *)[tableView dequeueReusableCellWithIdentifier:@"Regular"];
              [tmpCell.label1 setText:[NSString stringWithFormat:@"%@", [innerData objectAtIndex:0]]];
  
              cell = tmpCell;
               tmpCell.textLabel.numberOfLines=2;
          }
      }
          break;
  }
  
  
  
  return cell;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  if(indexPath.row == 0)
      return;
  
  if(indexPath.row != self.selectedIndex &amp;&amp; self.selectedIndex &gt; 0)
  {
      // Selected different row while there is another selected row
  
      int oldIndex = self.selectedIndex;
      self.selectedIndex = indexPath.row;
  
      NSArray * innerData = [self.data objectAtIndex:oldIndex - 1];
  
      [self.data removeObjectAtIndex:oldIndex - 1];
  
      NSIndexPath * deselectedIndexPath = [NSIndexPath indexPathForRow:oldIndex inSection:0];
      [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:deselectedIndexPath] withRowAnimation:UITableViewRowAnimationNone];
  
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.0 * NSEC_PER_SEC),
                     dispatch_get_main_queue(),
                     ^{
                         [self.data insertObject:innerData atIndex:deselectedIndexPath.row - 1];
                         [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:deselectedIndexPath] withRowAnimation:UITableViewRowAnimationTop];
                         [tableView reloadData];
  
                         NSArray * innerData = [self.data objectAtIndex:indexPath.row - 1];
                         [self.data removeObjectAtIndex:indexPath.row - 1];
                         [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
                         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC),
                                        dispatch_get_main_queue(),
                                        ^{
                                            [self.data insertObject:innerData atIndex:indexPath.row - 1];
                                            [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop];
                                            [tableView reloadData];
                                        });
                     });
  }
  else
  {
      if(indexPath.row == self.selectedIndex) // selected active row -&gt; close
          self.selectedIndex = -1;
      else                                    // selected inactive row -&gt; open
          self.selectedIndex = indexPath.row;
  
      NSArray * innerData = [self.data objectAtIndex:indexPath.row - 1];
      [self.data removeObjectAtIndex:indexPath.row - 1];
      [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC),
                     dispatch_get_main_queue(),
                     ^{
                         [self.data insertObject:innerData atIndex:indexPath.row - 1];
                         [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop];
                         [tableView reloadData];
                     });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>now i want to store the text entered in each field specific to that cell i searched a lot of tutorials but i could not find it </p>
  
  <p>please provide me with suitable solution ASAP </p>
  
  <p>thanks in advance</p>