-(CGFloat)tableView:(UITableView *)tableView
heightForHeaderInSection:(NSInteger)section{
return self.view.bounds.size.height/3 ;
}
-(UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section{
UIView *view =
[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width,self.view.bounds.size.height/3)];
view.backgroundColor =
[UIColor purpleColor];
return view ;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
if (scrollView == self.tableView)
{
CGFloat height
= self.view.bounds.size.height/3;
if (scrollView.contentOffset.y <=
height && scrollView.contentOffset.y > 0)
{
scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
NSLog(@"1...%f",scrollView.contentOffset.y);
}
else if(scrollView.contentOffset.y >=
height){
scrollView.contentInset = UIEdgeInsetsMake(-height, 0, 0, 0);
NSLog(@"2...%f",scrollView.contentOffset.y);
}
}