01-去除tableView plain 样式 SectionHeaderView 的悬浮方法:
//去除tableView 悬浮办法
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat sectionHeaderHeight;
if (IS_IPAD){
sectionHeaderHeight = 88;
}else if (IS_IPHONE6PLUS) {
sectionHeaderHeight = 66;
}else{
sectionHeaderHeight = 52;
}
if (scrollView == _profileTableView) {
//去掉UItableview的section的headerview黏性
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);
}
}
}```
#####悬浮中
![tableView去除sectionView悬浮.png](http://upload-images.jianshu.io/upload_images/1054708-a67a01fc789278ed.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
#####去除掉悬浮
![悬浮效果已去除.png](http://upload-images.jianshu.io/upload_images/1054708-328d041c9442daad.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
###02-TableView分隔线全部补全,也就是顶到头
```<objc>
#pragma mark 补全分隔线的方法
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)])
{
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)])
{
[cell setPreservesSuperviewLayoutMargins:NO];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)])
{
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
代码效果