tableView的每个section 的headerView或者footerView随tableView一起滚动
来源:互联网 发布:淘宝1.74非球面镜片 编辑:程序博客网 时间:2024/06/05 11:46
iOS开发过程中,经常会需要在tableview的section头部或尾部添加view,我们希望这些view 能够跟随tableview一起滚动,但常常会出现悬浮情况,类似黏性。下面提供几种解决方法:
1.最简单的方法,就是将UIView设置为整个tableView的headerView或者footerView而不是某个section的headerView或footerView。
2.将tableView的style设置为UITableViewStyleGrouped,例如在controller的.m中实现:(MemberCenterViewController是自己新建的当前类的名称)
- (MemberCenterViewController *)init {
self = [super initWithStyle:UITableViewStyleGrouped];
return self;
}
3.第三种方法在前面两个方法都不能实现的情况下可以考虑使用。
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- CGFloat sectionHeaderHeight = 10; //这里是我的headerView和footerView的高度
- if (_tableView.contentOffset.y<=sectionHeaderHeight&&_tableView.contentOffset.y>=0) {
- _tableView.contentInset = UIEdgeInsetsMake(-_tableView.contentOffset.y, 0, 0, 0);
- } else if (_tableView.contentOffset.y>=sectionHeaderHeight) {
- _tableView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
- }
- }
阅读全文
0 0
- tableView的每个section 的headerView或者footerView随tableView一起滚动
- 让tableView的每个section的headerview随tableview一起滚动
- 不让tableview的每个section的headerview随tableview一起滚动
- 让tableview的每个section的headerview随tableviewo一起滚动
- tableview的headerview和footerview的做法
- UITableView去掉headerView和footerView的粘性,随tableview滚动(有瑕疵)
- 如何设置ios tableView的section跟着tableView一起滚动
- 去掉tableview中section的headerview粘性
- ios tableview 那些事(二十三) 解决headerView不随cell一起滚动的问题
- 取消TableView的headerView和footerView的悬停效果
- 为UICollectionView的每个section设置footerView和headerView
- iOS storyboard中设置TableView的headerview 和 footerview
- 怎么让tableview的section的headerView随着cell一起滑动
- 自定义tableview的footerview
- iOS开发-去掉UITableView HeaderView或FooterView随tableView 移动的黏性(sticky
- 【iOS】TableView的footerView不随cell滚动而停留在tableView底部的问题
- TableView的footerView不随cell滚动而停留在tableView底部的问题,ios tableviewfooter
- 让UITableView的headerView或footerView跟随cell一起滚动
- android
- 蒲慕明教授写给他实验室工作人员和学生的信
- LintCode天梯(USGiants)-Binary Search
- JSP获取绝对路径(java代码)
- mfc 不支持尝试执行的操作 错误
- tableView的每个section 的headerView或者footerView随tableView一起滚动
- 公司内部wiki,你建立了么?
- jquery对象怎么转换为html对象(也就是js的dom对象)
- 在windows上 部署 Redis cluster模式的集群服务
- ASP.NET页面传值汇总 (Session / Server.Transfer / Query String / Cookie / Application )
- 2017.06.01回顾
- Linux下获取文件大小,检索目录函数
- DelayedOperation分析
- eclipse 快捷键失效 Ctrl+S Ctrl+F Ctrl+Z