项目介绍:
tableView滑动悬停,包括头部部分多层级cell
仓库地址 https://github.com/XueYangLee/TableViewFloat
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.tableView) {
CGFloat bottomCellOffset = [self.tableView rectForSection:1].origin.y - (STATUS_HEIGHT+44);
bottomCellOffset = floorf(bottomCellOffset);
if (scrollView.contentOffset.y >= bottomCellOffset) {
scrollView.contentOffset = CGPointMake(0, bottomCellOffset);
if (self.canScroll) {
self.canScroll = NO;
self.containerCell.objectCanScroll = YES;
}
}else{
//子视图没到顶部
if (!self.canScroll) {
scrollView.contentOffset = CGPointMake(0, bottomCellOffset);
}
}
}
}