How to get notified when scrollToRowAtIndexPath finishes animating

前端 未结 6 1867
梦如初夏
梦如初夏 2020-11-30 09:57

This is a follow-up to How to get notified when a tableViewController finishes animating the push onto a nav stack.

In a tableView I want to deselect a

6条回答
  •  星月不相逢
    2020-11-30 10:20

    try this

    [UIView animateWithDuration:0.3 animations:^{
        [yourTableView scrollToRowAtIndexPath:indexPath 
                             atScrollPosition:UITableViewScrollPositionTop 
                                     animated:NO];
    } completion:^(BOOL finished){
        //do something
    }];
    

    Don't forget to set animated to NO, the animation of scrollToRow will be overridden by UIView animateWithDuration.

    Hope this help !

提交回复
热议问题