码迷,mamicode.com
首页 > 移动开发 > 详细

去掉UITableView HeaderView或FooterView随tableView 移动的黏性

时间:2014-10-14 19:22:29      阅读:356      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   sp   div   on   cti   log   

去掉UITableView HeaderView或FooterView随tableView 移动的黏性(sticky)

控制器中实现以下方法即可:

 1 - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
 2 
 3     CGFloat sectionHeaderHeight = 40;
 4 
 5     if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {
 6 
 7         scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
 8 
 9     } else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
10 
11         scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
12 
13     }
14 
15 }

 

去掉UITableView HeaderView或FooterView随tableView 移动的黏性

标签:style   blog   color   io   sp   div   on   cti   log   

原文地址:http://www.cnblogs.com/myios/p/4024875.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!