title: Refresh NSTableView After Click - Not Refreshing
body: <p>I have an app with a UITableView, using both icons and disclosure buttons.  I want to update the icon on a row with a "selected" icon, and update the previously-selected row with an "unselected" icon.  I have the code in place, but when I click on the rows, it sets both rows to the "selected" state, even though via debugging I can see that my state variable is being set to the correct row.  If I keep clicking rows I can sometimes get the "unselected" state to show. I suspect it's a refresh issue, but I've tried the setNeedsDisplay method on the cells and the tableView itself, but with no luck.  Anyone run into this before?  BTW, this is in the simulator (2.2.1) - haven't tried it on the device.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
      {
          int newRow = [indexPath row];
          int oldRow = [lastIndexPath row];
  
          if (newRow != oldRow)
          {
              [[tableView cellForRowAtIndexPath:indexPath] setImage: [UIImage imageNamed:@"IsSelected.png"]];
  
              c_oListPtr.c_sCurItem = [[tableView cellForRowAtIndexPath:indexPath] text];
  
              [[tableView cellForRowAtIndexPath:lastIndexPath] setImage: [UIImage imageNamed:@"NotSelected.png"]];
  
              [lastIndexPath release];
              lastIndexPath = indexPath;
  
              [[tableView cellForRowAtIndexPath:lastIndexPath] setNeedsDisplay];
              [[tableView cellForRowAtIndexPath:indexPath] setNeedsDisplay];
              [tableView setNeedsDisplay];
          }
  
          [tableView deselectRowAtIndexPath:indexPath animated:YES];
      }
  </code></pre>
  
  <p>Thanks
  -Mike</p>