reloadData in didSelectRowAtIndexPath with deselectRowAtIndexPath:animated:YES

Discussion in 'iOS Programming' started by xinevil, Apr 13, 2009.

  1. xinevil macrumors newbie

    Jul 12, 2008
    I have an UITableView which allows selection. After selecting a row, the second section must be reloaded, so I run a [tableView reloadData].
    But the problem is that in the "- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath"-function, I do a "[tableView deselectRowAtIndexPath:indexPath animated:YES];".
    When the data is reloaded, my cell gets deselected immediately, and I don't see the animation. Is there a way to fix this?
  2. fishkorp macrumors 68020


    Apr 10, 2006
    Ellicott City, MD
    This certainly isn't the best solution, but use a Timer? Deselect with animation, wait x amount of time (second? two seconds?) then reload the data?
  3. xinevil thread starter macrumors newbie

    Jul 12, 2008
    Yeah I have that now. The strange thing is, even with a timer of 0.001 seconds it works as it should :confused: .

Share This Page