tableview 的格式为UITableViewStylePlain,去掉headerview的黏连性

来源:互联网 发布:轴类零件数控加工编程 编辑:程序博客网 时间:2024/05/16 18:49
在viewcontroller中实现如下方法- (void)scrollViewDidScroll:(UIScrollView *)scrollView {        if (scrollView == _table) {        CGFloat sectionHeaderHeight = 50;        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);        }    }   }
如果是ios7版本以上在viewdidload 实现以下代码,否则会出现滑动后区头被导航条遮住
   if ([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0) {        self.edgesForExtendedLayout = UIRectEdgeNone;    }    


0 0
原创粉丝点击