博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
去除UITableViewheader footer黏性
阅读量:7071 次
发布时间:2019-06-28

本文共 821 字,大约阅读时间需要 2 分钟。

项目中遇到问题,如何去除tableview的headerview和footerview黏性。 这里有两种解决方案 1.最简单的方案 设置UITabeview的样式为UITableViewStyleGrouped 2.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {    //解决header黏性    CGFloat sectionHeaderHeight = 100;// head的高度    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);    }}复制代码

还有一种方法 :

// 分区foot返回高度- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {        return 10;}//分组 底部-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{    return [UIView new];}复制代码

转载地址:http://neell.baihongyu.com/

你可能感兴趣的文章
数据库并行读取和写入(Python实现)
查看>>
Spring学习(15)--- 基于Java类的配置Bean 之 @Bean & @Scope 注解
查看>>
英语写作-----赖世雄<<突破英语写作关>>笔记
查看>>
MySQL批量导出以某数字或字母开头的表
查看>>
java变长参数
查看>>
状态和面向对象编程——2.状态介绍
查看>>
html -- 实体
查看>>
SVN中的check out与export的区别
查看>>
如何重新注册VMware Update Manager(VUM)至vCenter Server中
查看>>
hdu1754
查看>>
vue前端页面跳转参数传递及存储
查看>>
使用Google Analytics跟踪下载等事件
查看>>
Netty服务器连接池管理设计思路
查看>>
5.多个Storyboard切换
查看>>
Vue CLI 3开发中屏蔽烦人的EsLint错误
查看>>
批量分发管理三种解决方案案例视频分享
查看>>
Scrum方法论(四)
查看>>
处理windows 2008x64平台exchange 2010 sp1打完系统补丁后,控制台无法打开
查看>>
Windows Server 2016-命令行Ntdsutil迁移FSMO角色
查看>>
征服Perl——基础知识——里程碑M4
查看>>