UITableView的粘着性

当作为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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容