zoukankan      html  css  js  c++  java
  • iOS UIScrollView滚动方法对比

    项目中我们经常会使用到使视图滚动的方法,不管是collectionview或者是tableview最终都是使用以下方法

    -(void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;//以恒定速度动画到新偏移
    -(void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;//滚动使rect刚好可见(最近的边)。如果完全可见就什么都没有

    但在某些系统下 -(void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;方法滚动并不生效。

    可以使用 -(void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;方法替代。

    //    这个方法在部分系统下不好使 有莫名其妙的问题 时好时不好
    //    [self.contentCollectionView scrollRectToVisible:CGRectMake(indexPath.row*LL_ScreenWidth,self.contentCollectionView.frame.origin.y, self.contentCollectionView.frame.size.width, self.contentCollectionView.frame.size.height) animated:NO];
        
        [self.contentCollectionView setContentOffset:CGPointMake(toRow*LL_ScreenWidth, 0) animated:NO];
  • 相关阅读:
    HBase的compact分析
    HBase Rowkey的散列与预分区设计
    Zookeeper 快速理解
    oozie 入门
    Apache Storm内部原理分析
    Java ArrayList源码剖析
    Java HashSet和HashMap源码剖析
    初步掌握Yarn的架构及原理
    UML用例图总结
    UML类图几种关系的总结
  • 原文地址:https://www.cnblogs.com/lijianyi/p/13964046.html
Copyright © 2011-2022 走看看