ScrollViewDidScroll: by UITableViewRowAnimation?

When you use UITableViewRowAnimationwhen deleting a row or adding a row, sometimes if this row is at the extreme of the table, the table scrolls.

However, even though it scrolls, it does not seem to call scrollViewDidScroll:for the delegate.

For example, I have the following code in my delegate.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSLog(@"Scrolling %f", scrollView.contentOffset.y);
}

which is called if the user scrolls. But when I delete the line:

[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];

The method scrollViewDidScroll:is not called at all.

Is there any way to make sure this is caused when the animation UITableView?

Thank!

+4
source share
2 answers

, scrollViewDidScroll (, , ). - . . , . , :

UIScrollView scrollViewDidScroll

+1

.

    [CATransaction setCompletionBlock: ^{
        // do stuff
    }];

    [CATransaction begin];

    [tableView beginUpdates];
    [tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
    [tableView endUpdates];

    [CATransaction commit];
0

Source: https://habr.com/ru/post/1533433/


All Articles