UITableView的粘着性

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


UITableView的粘着性_第1张图片
Simulator Screen Shot 2016年2月2日 下午3.04.12.png
UITableView的粘着性_第2张图片
Simulator Screen Shot 2016年2月2日 下午3.03.53.png

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


UITableView的粘着性_第3张图片
Simulator Screen Shot 2016年2月2日 下午3.06.19.png

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

UITableView的粘着性_第4张图片
Simulator Screen Shot 2016年2月2日 下午3.10.48.png

UITableView的粘着性_第5张图片
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);
    }
    }
    效果:


    UITableView的粘着性_第6张图片
    Simulator Screen Shot 2016年2月2日 下午3.10.48.png

UITableView的粘着性_第7张图片
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的粘着性)