让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 ...
随机推荐
- 使用map()的小陷阱:parseInt
假设我们想要把一个字符串数组的每一项转换成整数,我们很自然就想到了把parseInt作为回调函数传给map()函数,但这样做可能会出现意想不到的结果: var strArr = ["1&qu ...
- linux下vim的安装及其设置细节
第一步:使用apt安装vim sudo apt-get install vim 第二步:行号及其tab建设置 vim ~/.vimrc 添加如下文字 set nu //代码显示行号syntax on ...
- Homebrew简介及安装,Mac 包管理
Homebrew简介及安装 Homebrew官网 http://brew.sh/index_zh-cn.html Homebrew是神马 Linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两 ...
- Arcgis Server 本地化
一.将API包放入server文件夹 将3.18的arcgis API 解压放入Arcgis Server的安装目录的……\Server\framework\runtime\tomcat\webapp ...
- CCF-再卖菜-20180904
可以说这道题出的不错,我是用动态规划做的 ( 严谨点说应该是记忆化搜索,我是递归版本,非递归我不会啊... 题意分析: x1 x2 x3 已知 x1+x2=t1或t1+1 x1+x2+x3=t2 ...
- Python:从入门到实践--第十章--文件和异常--练习
#.python学习笔记:在文本编辑器中新创建一个文件,写几句话老总结你至此学到的python知识 #其中‘In Python you can’ 打头.将这个文件命名为learning_python. ...
- switch留个爪,之后还需要再研究下
public class SwitchDemo { public static void main (String [] args) { for(int i = 0; i < 10; i++) ...
- 基于VM上的Ubuntu16.04如何和window界面进行复制,粘贴工作
1.卸载VMware tools: sudo apt-get autoremove open-vm-tools 2.安装界面版VMware tools. sudo apt-get install op ...
- 第二节《Git暂存区》
在上一节中我们的demo版本库经历了一次提交,我们可以使用git og --stat查看一下提交日志. [root@git demo]# git log --statcommit 986a1bd458 ...
- Vue组件的介绍与使用
组件系统是将一个大型的界面切分成一个一个更小的可控单元. 组件是可复用的,可维护的. 组件具有强大的封装性,易于使用. 大型应用中,组件与组件之间交互是可以解耦操作的. 全局组件的使用 <!DO ...