title: Get row number of UITableview with multiple sections
body: <p>I have a <code>UITableView</code>, with multiple sections in it, and each section has multiple rows. I want to get the row number of selected cell with respect to the entire table and not the section only.</p>
  
  <p>example:</p>
  
  <ol>
  <li>I have two sections in the <code>UITableView</code>, section 1 has 3 rows and section 2 has 5 rows.</li>
  <li>When I select sections 2's 2nd row, I should get the 5 as the row number in <code>didSelectRowAtIndexPath</code> method, rather than getting 2 as the row number (which is with respect to the section).</li>
  </ol>
  
  <p>I tried to get the row number myself by doing the following, but it does not seem to work:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
  
  NSLog(@"%d",indexPath.row);
  
  int theRow =  indexPath.row;
  
  NSLog(@"%d",theRow);
  }
  </code></pre>
  
  <p>I was thinking of storing the row number in an <code>int</code>variable, and then add row numbers to it myself, but the code crashes when trying to store  <code>indexpath.row</code> in <code>theRow</code> .</p>
  
  <p>Please help. Thank you</p>