ios tableView sectionHeader 吸顶效果
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ios tableView sectionHeader 吸顶效果相关的知识,希望对你有一定的参考价值。
参考技术A ios tableView sectionHeader 吸顶效果ceilPositon是我需要的section header的吸顶位置,当tableView的偏移量小于sectionHeaderHeight的时候,正常显示;当tableView的偏移量大于ceilPositon,也就是我们期望的吸顶位置的时候,我们就把scrollView.contentInset的top置为sectionHeaderHeight的高度,于是就实现了我们想要的效果,可以随意更改section header的吸顶位置。同样,此方法也可以使plain类型的tableview失去粘性效果,只需要改变scrollView.contentInset即可.
————————————————
原文链接: https://blog.csdn.net/axllll/article/details/50502475
UITableViewStyleGrouped 类型 tableView sectionHeader 高度问题
UITableViewStyleGrouped 类型的 tableView 在适配的时候出现很大的问题。记录一下
按照之前的方法,只需要执行以下的代码就能够很好的解决 section == 0 的时候,sectionHeader 的高度问题以及 section 间距的问题
tableView.delegate = self; tableView.dataSource = self; tableView.sectionFooterHeight = 0.01f; tableView.tableFooterView = [UIView new];
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 10.0f)]; return headerView; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 0) { return 0.01; } return 10; } - (CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section { return 0.001; }
以上是关于ios tableView sectionHeader 吸顶效果的主要内容,如果未能解决你的问题,请参考以下文章
UITableViewStyleGrouped 类型 tableView sectionHeader 高度问题