【问题】tableView的每组的头部不不能滚动的解决方案

group模式的解决方案

- (void)scrollViewDidScroll:(UIScrollView*)scrollView
{
    if (scrollView == self.tableView) {
        CGFloat sectionHeaderHeight = HeaderHeight;
        if (scrollView.contentOffset.y < sectionHeaderHeight && scrollView.contentOffset.y >= - HeaderHeight) {
            scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
        }
        else if (scrollView.contentOffset.y >= sectionHeaderHeight) {
            scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
        }
    }
}
plain模式的解决方案

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

    CGFloat sectionHeaderHeight = ;

    ) {

        scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, , , );

    } else if (scrollView.contentOffset.y>=sectionHeaderHeight) {

        scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, , , );

    }

}
上一篇:Java 常见异常及趣味解释


下一篇:南京邮电大学CTF隐写术部分Writeup