I'm trying to code a feed so it's just a basic UITableView with one row per section and as many sections as posts. If I select a cell the tableView displays a cell in the row 1 in the same section than the selected cell, and if I re-select the cell or scroll the tableView the row 1 is deleted.
The problem is that if i select the first cell and then scroll to the bottom (like a pull to refresh), the tableView scroll while the animation of the deleting cell is done then at the end of the animation jumps to the top of the screen and then return where he was.
I don't know if that was clear.
Here's my scrollViewDidScroll
def scrollViewDidScroll(scroll_view)
return if @can_scroll_comments
hide_comments unless @comment_triggered_for == -1
end
def hide_comments
feed_view = layout.get(:feed_view)
section = @comment_triggered_for
@comment_triggered_for = -1
feed_view.deleteRowsAtIndexPaths([NSIndexPath.indexPathForRow(1, inSection: section)], withRowAnimation: UITableViewRowAnimationFade)
end
in objective-c it should be something like
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (_can_scroll_comments) {
return ;
}
if (_comment_triggered_for != -1) {
[self hide_comments];
}
}
- (void)hide_comments: {
section = _comment_triggered_for
_comment_triggered_for = -1
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:section]] withRowAnimation:UITableViewRowAnimationFade];
}
Thanks for the help :)