scrollView滑动协议方法探究

2021-01-19  本文已影响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...
上一篇下一篇

猜你喜欢

热点阅读