I have a UITableView with many rows. It looks like an accordion: http://docs.jquery.com/UI/Accordion
Main cells have subelements, subelements also have subelements. So this is a three-level tableView.
Well, when the user selects a cell, it expands (or collapses) the sublifts with the string animation. But I need to set a new size for tableView and scrollView.
I do all this in this method:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Problem: When the user clicks on the cell, then quickly tap the sub, the second animation will not be performed, so the subelements of level 2 are not displayed. But the size was set (given that the subelements of level 2 are shown).
I actually play with time to handle this ... but it really sucks.
Here is an example of my code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView beginUpdates];
if(position.isExpanded == YES)
[tableView reloadRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationBottom];
else
[tableView reloadRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationTop];
[tableView endUpdates];
}
So, I would like to catch the end of this animation. Or, playing with some kind of semaphore (but I only have 1 process ...) Any ideas to fix this?
Please keep in mind in your answers that I am really new to iPhone development.
Thank.
source
share