PDA

View Full Version : reloadData in didSelectRowAtIndexPath with deselectRowAtIndexPath:animated:YES




xinevil
Apr 13, 2009, 02:42 PM
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?



fishkorp
Apr 13, 2009, 03:43 PM
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?

xinevil
Apr 13, 2009, 03:48 PM
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?
Yeah I have that now. The strange thing is, even with a timer of 0.001 seconds it works as it should :confused: .