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



1.签协议(如果直接用UIScrollView ,就签 UIScrollViewDelegate

<UITableViewDataSource,UITableViewDelegate>


2.设置代理人( _scrollVIew.delegate = self; )
_tableView.delegate = self;

_tableView.dataSource = self;


3.实现方法
- (void)scrollViewDidScroll:(UIScrollView*)scrollView {
   
   
if (scrollView ==_tableView)
       
    {        
        ///////////////////直接写里边的部分
       CGFloatsectionHeaderHeight =64;//sectionHeaderHeight
       
       
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 HeaderView或FooterView随tableView 移动的黏性(sticky)