让UITableView的section header view不悬停的方法
当 UITableView
的 style
属性设置为 Plain
时,这个tableview的section header在滚动时会默认悬停在界面顶端。取消这一特性的方法有两种:
- 将
style
设置为Grouped
。这时所有的section header都会随着scrollview滚动了。不过grouped
和plain
的样式有轻微区别,切换样式后也许需要重新调整UI - 重载scrollview的delegate方法
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat sectionHeaderHeight = 40;
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);
}
}
让UITableView的section header view不悬停的方法的更多相关文章
- UITableView section header 不固定
iOS系统自带的UITableView,当数据分为多个section的时候,在UITableView滑动的过程中,默认section header是固定在顶部的,滑动到下一个section的时候,下一 ...
- tableview: 实现tableview 的 section header 跟随tableview滑动
方法一:(只有一个headerView)一段 如果你的tableview恰好只有一个headerView,实现这种效果就好办了.把要设置的headerView设置成tableView的header而不 ...
- UITableView去掉section的header的粘性
思路:若header的高度为25,在滑动的时候将scrollView的内容偏移量上衣25,其实他还是粘在上面只不过我们看不到他了. ///---用于判断往上滑还是往下滑 var deltaY:CGFl ...
- iOS- 如何改变section header
希望这个从UITableViewDelegate协议里得到的方法可以对你有所帮助: - (UIView *) tableView:(UITableView *)tableView viewForHea ...
- UItableview里面的header、footer
#import "ViewController.h" #import "MJRefresh.h" @interface ViewController () { ...
- 下拉刷新和UITableView的section headerView冲突的原因分析与解决方案
UITableView:下拉刷新和上拉加载更多 [转载请注明出处] 本文将说明具有多个section的UITableView在使用下拉刷新机制时会遇到的问题及其解决方案. 工程地址在帖子最下方,只需要 ...
- 设置TableView section header的颜色
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInte ...
- 快速设置UITableView不同section对应于不同种类的cell
快速设置UITableView不同section对应于不同种类的cell 本文主要是为了写明如何在UITableView中,一个section对应于一种类型的cell,写起来不凌乱. 在不封装任何类的 ...
- java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called.
分析:android 4.2.X及以下的版本,addHeaderView必须在setAdapter之前,否则会抛出IllegalStateException. android 4.2.X(API 17 ...
随机推荐
- linux远程管理常用命令
目标 关机/重启 shutdown 查看或配置网卡信息 ifconfig ping 远程登录和复制文件 ssh scp 01. 关机/重启 序号 命令 对应英文 作用 01 shutdown 选项 时 ...
- Hadoop学习笔记05_HA
################# HA 即 High Available 高可用.# 其作用是为了减少主从结构的单点故障,而设置备用节点,既然学习了Hadoop生态圈,那么HA配置也是必须要掌握的. ...
- grep语法2
grep 参数 -n :显示行号-o :只显示匹配的内容-q :静默模式,没有任何输出,得用$?来判断执行成功没有,即有没有过滤到想要的内容 -l :如果匹配成功,则只将文件名打印出来,失败则 ...
- 什么是Maven项目
1.通俗理解Maven:https://blog.csdn.net/shuzhe66/article/details/45009175 个人总结: Maven项目会有pom文件! 当前的项目需要依赖其 ...
- 将100道计算题输出至txt文件,再读取文件至控制台,在控制台中输入答案并评判对错
我在课堂上基本完成了输出100道题和创建文档,但是因为对输入输出流不熟悉,所以并没有实现将输出的计算题导出到文档里,在课下我又请教了宿舍的大佬,基本完成如下: 源代码: import java.io. ...
- 【SpringData学习】
1.注解@Modifying 在springData中,大部分给出的接口都是查询的,那要进行删除和更新的时候,大部分都需要使用@Query 进行手写代码.并且需要使用@Modifying注解. 使用场 ...
- How to create your iOS team provisioning profile ?
From Apple Developer: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppS ...
- angular2 ng2-validation 表单验证
1:安装模块 npm install ng2-validation --save 2:配置app.module.ts import { FormsModule, <font color=&quo ...
- 2018.5.2 file结构体
f_flags,File Status Flag f_pos,表示当前读写位置 f_count,表示引用计数(Reference Count): dup.fork等系统调用会导致多个文件描述符指向同一 ...
- python:Hamlet英文词频统计
#CalHamletV1.py def getText(): #定义函数读取文件 txt = open("hamlet.txt","r").read() txt ...