1. 程式人生 > >有關Tableview滑動出現的問題

有關Tableview滑動出現的問題

ets float pragma mar 搜索 tof stat make sta

#pragma mark section不懸停

static CGFloat const sectionHeight = 12.0f;//section的高度值

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

CGFloat sectionHeaderHeight = sectionHeight;

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);

}

}

//解決搜索滑動後view下移的問題

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

CGFloat off_y = scrollView.contentOffset.y;

if (off_y < 0) {

self.tableView.contentOffset = CGPointMake(0, 0);

}

}

有關Tableview滑動出現的問題