iOS开发-设置headerInsectionView不悬浮
来源:互联网 发布:视频监控软件免费版 编辑:程序博客网 时间:2024/04/29 02:58
UITableView有两个headerView:tableHeaderView、和headerInsectionView(组头视图)。
给tableView添加这两个View:tableHeaderView是通过tableView.tableHeaderView = XXXView 的方式添加的,而headerInsectionView是通过- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section代理方法添加的。
UITableView的Style为Plain时,当tableView上移顶端的tableHeaderView会跟着滑出窗口,而headerInsectionView则会悬浮固定在窗口顶端不随着滑动继续上移。
UITableView的Style为Grouped时,当tableView上移顶端的tableHeaderView会跟着滑出窗口,而headerInsectionView则会随着滑动继续上移。
UITableView的Style为Plain时禁止headerInsectionView固定在顶端:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat sectionHeaderHeight = 50;
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);
}
}
阅读全文
0 0
- iOS开发-设置headerInsectionView不悬浮
- iOS开发-设置headerInsectionView不悬浮
- 设置headerInsectionView不悬浮
- iOS开发 TableView的headerInSectionView 不悬浮
- UITableView设置headerInsectionView不悬浮
- ios开发-设置内容置顶,状态栏悬浮可见
- (iOS开发) 自定义悬浮按钮
- 设置tableView的header不悬浮
- iOS开发-NSLog不打印设置
- iOS开发-NSLog不打印设置
- iOS开发-NSLog不打印设置
- iOS开发-NSLog不打印设置
- iOS开发-NSLog不打印设置
- iOS开发-NSLog不打印设置 Prefix
- 002、iOS开发-NSLog不打印设置
- iOS开发-NSLog不打印设置
- iOS开发-tableView上显示悬浮按钮悬浮窗
- 【iOS开发系列】collectionView头部悬浮
- 移动app开发,固定图片div宽高,根据实际图片大小控制图片不变形
- <一>练习 仿AideTeach 软件(android)
- Android APN
- 关于C#迭代器与Unity的Coroutine
- rocketmq注意点
- iOS开发-设置headerInsectionView不悬浮
- Python Qt GUI 环境配置
- android中dp dpi
- Windows 2008 R2 64位下安装Oracle 10.2.0.5【图解教程】
- 设置Actor在Stage的顶端
- 学生成绩管理系统_结构体、指针、存储、排序、动态内存分配
- 旋转图像-LintCode
- 作者访谈录
- js数组去重