美文网首页
判断scrollView、tableView滚动方向(上或下)

判断scrollView、tableView滚动方向(上或下)

作者: jan_yu | 来源:发表于2016-12-12 17:20 被阅读347次

判断scrollView、tableView滚动方向(上或下)

float lastContentOffset;
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    lastContentOffset = scrollView.contentOffset.y;
}
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{
    if (lastContentOffset < scrollView.contentOffset.y){
        NSLog(@"向上滚动");
    }else{
        NSLog(@"向下滚动");}
}

相关文章

网友评论

      本文标题:判断scrollView、tableView滚动方向(上或下)

      本文链接:https://www.haomeiwen.com/subject/conmmttx.html