tableView 让区头更随 cell 一起滚动
2015-09-24 14:24
316 查看
//去掉UItableview headerview黏性(sticky)
将一下方法粘过去改一个地方就够了
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.menuTableView)
{
CGFloat sectionHeaderHeight = 25; //sectionHeaderHeight你区头的高度
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);
}
}
}
将一下方法粘过去改一个地方就够了
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.menuTableView)
{
CGFloat sectionHeaderHeight = 25; //sectionHeaderHeight你区头的高度
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);
}
}
}
相关文章推荐
- ios中摄像头/相册获取图片,压缩图片,上传服务器方法总结
- 出差西楼
- 用php实现百度网盘图片直链的代码分享
- Android NDK开发学习(六)
- C++函数后加const的意义
- ScrollViewContainer scrollview容器的到顶部问题
- dumpsys alarm 格式解读
- [转]关于现代CPU,程序员应当更新的知识
- C# 获取远程xml文件
- 详解js面向对象编程
- 安装php phalcon扩展
- 京东下单时为什么要先加入购物车才能下单?
- yum安装出现No package vim available解决办法
- 时间同步
- Struts2的默认配置文件:struts-default.xml
- POJ 1251 Jungle Roads (最小生成树 Prim普里姆算法)
- umask
- C++ - _T含义 C++语言中“_T”是什么意思
- 这个周末我太累了
- inux上iptables防火墙的基本应用教程