zoukankan      html  css  js  c++  java
  • UIScrollViewDelegate协议方法

    #pragma mark 监听滚动停止
    
    // called on start of dragging (may require some time and or distance to move)
    // 开始拖动时调用(可能需要一些时间或距离才能移动)
    // 开始拖动时(手指在屏幕上)
    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
        NSLog(@"111~~~~~~~~~~scrollViewWillBeginDragging:%ld", (long)scrollView.contentOffset.y);
    }
    
    // any offset changes
    // 任何偏移更改
    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        NSLog(@"222~~~~~~~~~~scrollViewDidScroll:%ld", (long)scrollView.contentOffset.y);
    }
    
    // called on finger up if the user dragged. velocity is in points/millisecond. targetContentOffset may be changed to adjust where the scroll view comes to rest
    // 如果用户拖动,则调用finger up。速度以点/毫秒为单位。可以更改targetContentOffset以调整滚动视图的静止位置
    // 结束拖动时(手指离开屏幕)的速度(正-往上的速度,负-往下的速度)
    - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
        NSLog(@"333~~~~~~~~~~scrollViewWillEndDragging:%ld, velocity:%lf", (long)scrollView.contentOffset.y, velocity.y);
    }
    
    // called on finger up if the user dragged. decelerate is true if it will continue moving afterwards
    // 如果用户拖动,则调用finger up。如果减速后继续移动,则为真
    // 拖动完之后,如果会滑行,则为真
    - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
        NSLog(@"444~~~~~~~~~~scrollViewDidEndDecelerating:%ld, decelerate:%d", (long)scrollView.contentOffset.y, decelerate);
    }
    
    // called on finger up as we are moving
    // 当我们移动的时候手指向上
    // 开始滑行
    - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView {
        NSLog(@"555~~~~~~~~~~scrollViewWillBeginDecelerating:%ld", (long)scrollView.contentOffset.y);
    }
    
    // called when scroll view grinds to a halt
    // 当scroll view磨合停止时调用
    // 停止滑行
    - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
        NSLog(@"666~~~~~~~~~~scrollViewDidEndDecelerating:%ld", (long)scrollView.contentOffset.y);
    }
    
    // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating
    // 当setContentOffset/scrollRectVisible:animated:finishes完成时调用。如果不设置动画,则不调用
    - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
     NSLog(@"777~~~~~~~~~~scrollViewDidEndScrollingAnimation:%ld", (long)scrollView.contentOffset.y);
    }
    
    // called when scrolling animation finished. may be called immediately if already at top
    // 当滚动动画完成时调用。如果已经在顶部,可以立即调用
    // 当点击状态栏tableView回到顶部时调用
    - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView {
        NSLog(@"888~~~~~~~~~~scrollViewDidScrollToTop:%ld", (long)scrollView.contentOffset.y);
    }
    
    // Also see -[UIScrollView adjustedContentInsetDidChange]
    // tableView刚出现时会调用
    - (void)scrollViewDidChangeAdjustedContentInset:(UIScrollView *)scrollView {
        NSLog(@"999~~~~~~~~~~scrollViewDidChangeAdjustedContentInset:%ld", (long)scrollView.contentOffset.y);
    }
    
    // return a yes if you want to scroll to the top. if not defined, assumes YES
    // 如果要滚动到顶部,请返回“是”。如果没有定义,则假设是
    - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView {
        return YES;
    }
  • 相关阅读:
    Hadoop一直处于安全模式(hadoop去掉保护模式)
    日考
    MySQL中文编码
    Mussel使用系列(二):开始写我们的第一个Mussel插件项目
    什么是Mussel
    Mussel使用系列(四):从容器中访问Mussel的插件项目
    Mussel使用系列(三):Mussel插件树的构成及初步使用
    Mussel使用系列(五):插件项目之间的调用
    Mussel使用系列(一):Mussel配置文件演示
    C#委托探索之猫和老鼠
  • 原文地址:https://www.cnblogs.com/cchHers/p/12423838.html
Copyright © 2011-2022 走看看