如何去掉UITableView中的header和footer的粘连效果

来源:互联网 发布:网络机柜检测报告 编辑:程序博客网 时间:2024/04/25 08:51

只需要加入以下代码即可


- (void)scrollViewDidScroll:(UIScrollView *)scrollView {    CGFloat sectionHeaderHeight = 40;    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);    }} 




原创粉丝点击