美文网首页
UITableView的粘着性

UITableView的粘着性

作者: 胖渣大橘子 | 来源:发表于2016-02-02 14:59 被阅读0次

    当作为collectionViewCell的tableView的样式为plain时


    Simulator Screen Shot 2016年2月2日 下午3.04.12.png Simulator Screen Shot 2016年2月2日 下午3.03.53.png

    tabeleView滑动的时候 由于UITableView的粘着性


    Simulator Screen Shot 2016年2月2日 下午3.06.19.png

    解决一:将UITableView的plain改为group
    效果:

    Simulator Screen Shot 2016年2月2日 下午3.10.48.png Simulator Screen Shot 2016年2月2日 下午3.06.19.png

    解决二:UITableView的样式为plain

    • (void)scrollViewDidScroll:(UIScrollView *)scrollView
      {
      CGFloat sectionHeaderHeight = 55;
      if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {
      scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
      }
      else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
      scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
      }
      }
      效果:


      Simulator Screen Shot 2016年2月2日 下午3.10.48.png
    Simulator Screen Shot 2016年2月2日 下午3.03.53.png
    参考:UITableView的粘着性------------->
    https://github.com/facebook/react-native/issues/1974
    去掉UItableView的粘着性----------->
    http://blog.sina.com.cn/s/blog_801997310102vpa1.html

    相关文章

      网友评论

          本文标题:UITableView的粘着性

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