zoukankan      html  css  js  c++  java
  • IOS UIScrollView常用代理方法

    iOS UIScrollView代理方法有很多,从头文件中找出来学习一下

    //只要滚动了就会触发

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView;   

    {

    //    NSLog(@" scrollViewDidScroll");

        NSLog(@"ContentOffset  x is  %f,yis %f",scrollView.contentOffset.x,scrollView.contentOffset.y);

    }

    //开始拖拽视图

    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;   

    {

       NSLog(@"scrollViewWillBeginDragging");

    }

    //完成拖拽

    - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; 

    {

       NSLog(@"scrollViewDidEndDragging");

    }

    //将开始降速时

    - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;   

    {

       NSLog(@"scrollViewWillBeginDecelerating");

    }

    //减速停止了时执行,手触摸时执行执行

    - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;   

    {

       NSLog(@"scrollViewDidEndDecelerating");

    }

    //滚动动画停止时执行,代码改变时出发,也就是setContentOffset改变时

    - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;

    {

       NSLog(@"scrollViewDidEndScrollingAnimation");

    }

    //设置放大缩小的视图,要是uiscrollview的subview

    - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;   

    {

       NSLog(@"viewForZoomingInScrollView");

        return viewA;

    }

    //完成放大缩小时调用

    - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale; 

    {

        viewA.frame=CGRectMake(50,0, 100, 400);

       NSLog(@"scale between minimum and maximum. called after any 'bounce' animations");

    }// scale between minimum and maximum. called after any 'bounce' animations

    //如果你不是完全滚动到滚轴视图的顶部,你可以轻点状态栏,那个可视的滚轴视图会一直滚动到顶部,那是默认行为,你可以通过该方法返回NO来关闭它

    - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView;   

    {

        NSLog(@"scrollViewShouldScrollToTop");

       return YES;

    }

    - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView;     

    {

        NSLog(@"scrollViewDidScrollToTop");

    }

  • 相关阅读:
    Python的四种常见数据结构比较
    LeetCode Notes_#53 Maximum Subarray
    LeetCode Notes_#38 Count and Say
    LeetCode Notes_#6 Zigzag Conversion
    LeetCode Notes_#5 Longest Palindromic Substring
    《美国纽约摄影学院摄影教材》
    《艺术的故事》
    《Don't make me think》
    《Geospatial Data Science Techniques and Applications》
    《程序员的自我修养:链接、装载与库(完整版).pdf》
  • 原文地址:https://www.cnblogs.com/liangyi-cn/p/6900511.html
Copyright © 2011-2022 走看看