Perform a task (in iOS) after animation has finished

后端 未结 4 712
离开以前
离开以前 2021-02-04 07:11

So I have this line of code:

[tableView setContentOffset:point animated:YES];

and I want to run another piece of code after the animation ends. My a

4条回答
  •  别跟我提以往
    2021-02-04 07:48

    For a scrollView, tableView or collectionView if you do something like this:

    [self.collectionView setContentOffset:CGPointMake(self.collectionView.contentOffset.x+260.0,
                                                          self.collectionView.contentOffset.y)
                                     animated:YES];
    

    then you'll get back a:

    -(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
    

    when the scroll finishes.

    You do NOT get this callback if the user moves the view.

提交回复
热议问题