iOS--判断tableView 滚动方向

2019-07-29  本文已影响0人  我是那片海

直接上代码

#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{

    if (scrollView.panGestureRecognizer.state != UIGestureRecognizerStateChanged) return;
    
    CGPoint velocity = [scrollView.panGestureRecognizer velocityInView:scrollView.panGestureRecognizer.view];
    
    if(velocity.y >0 ){
    //向下滑动 
    }else{
    //向上滑动  
    }
}

上一篇下一篇

猜你喜欢

热点阅读