title: Determine the last selected row when returning from detailView of UITableView
body: <p>Ok I push a detailView when row is selected in the UITableView. In the detailView I set som data and pass that to the webservice. I want to retrieve some data either before the detailView is pushed or when it will disapear. Based on the data retrieved will I set an UIImage as an indicator. </p>
  
  <p>I wonder how I can determine the indexpath.row the detailView got pushed for and use that for setting the UIImage. Is this possible? </p>
  
  <p>I have a UISegmentedControl which loads two different datasources for the UITableView. </p>
  
  <p>For testing I pass the indexpath.row when the detailView is pushed and callback to the UITableView class along with a boolean if the UIImage should be display.</p>
  
  <p>But my problem is that indexpath.row is 0 when the UITableView loads. 
  And when changing datasource back and forth and passing the indexpath.row with it, the indicator will be display on wrong rows. </p>
  
  <p>The two datasources for the table is:</p>
  
  <pre><code>if (index == 0) {
  
      dictionary = [firstArray objectAtIndex:indexPath.row];
  }
  else {
  
      dictionary = [secondArray objectAtIndex:indexPath.row]; 
  }
  </code></pre>
  
  <p>I then set the indicator for that row (will be the UIImage later):</p>
  
  <pre><code>if (indexPath.row == selectedIndex) {
      cell.indicator.text = @"Begin";
  }
  </code></pre>
  
  <p>When the detailView is pushed in <strong><em>didSelectRowAtIndexPath</em></strong> i pass in the indexPath.row:</p>
  
  <pre><code>NSInteger rowIndex = indexPath.row;
  [self.detailViewController initWithDetailsSelected:rowIndex:dictionary];
  </code></pre>
  
  <p>When the detailView is done the UITableView class receives the callback:</p>
  
  <pre><code> - (void)processAttendanceSuccessful:(BOOL)successful:(NSInteger)_selectedIndex{
  
  self.selectedIndex = _selectedIndex;
   }
  </code></pre>
  
  <p>So based on a boolean a UIImage should be display for the correct row in the UITableView. 
  Any suggestions how I can go about this. It must be quite common to set some value in a detailedView and display some data for a specific row in the UITableView, but having a rather hard time finding any good tutorials for this. 
  I only find how to pass data into the detailView, which I dont have any problem with.</p>
  
  <p>Thanks in advance people. </p>