您的位置:首页 > 其它

tableView 让区头更随 cell 一起滚动

2015-09-24 14:24 316 查看
//去掉UItableview headerview黏性(sticky)

将一下方法粘过去改一个地方就够了

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

if (scrollView == self.menuTableView)

{

CGFloat sectionHeaderHeight = 25; //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);

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: