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

时间:2014-10-14 18:47:00   收藏:0   阅读:433

去掉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 }

 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!