tableView 让区头更随 cell 一起滚动
//去掉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);
}
}
}
将一下方法粘过去改一个地方就够了
- (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);
}
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.