iOS讓UITableView的表頭隨着tableView一塊兒滾動。

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

    

    CGFloat sectionHeaderHeight = 40;3d

    

    if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {orm

        

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

        

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

        

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

        

    }top

    

}ant

相關文章
相關標籤/搜索