美文网首页
scrollView滑动协议方法探究

scrollView滑动协议方法探究

作者: 落叶兮兮 | 来源:发表于2021-01-19 11:35 被阅读0次

    最近在尝试实现一个滑动下方的UITableView,可以改变上方view的大小的功能,类似B站中竖屏视频的功能,刚好记录一下UIScrollView滑动时调用的顺序,代码中添加了以下代码

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        NSLog(@"scrollViewDidScroll...");
    }
    
    - (void)scrollViewDidZoom:(UIScrollView *)scrollView {
        NSLog(@"scrollViewDidZoom...");
    }
    
    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
        NSLog(@"scrollViewWillBeginDragging...");
    }
    
    - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
        NSLog(@"scrollViewWillEndDragging...");
    }
    
    - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView {
        NSLog(@"scrollViewWillBeginDecelerating...");
    }
    
    - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
        NSLog(@"scrollViewDidEndDecelerating...");
    }
    

    拖动UITableView,发现调用的顺序如下

    先调用scrollViewWillBeginDragging...
    接下来若干scrollViewDidScroll...
    再调用scrollViewWillEndDragging...
    调用scrollViewWillBeginDecelerating...
    若干scrollViewDidScroll...
    最后scrollViewDidEndDecelerating...
    

    相关文章

      网友评论

          本文标题:scrollView滑动协议方法探究

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