swift 分组tableview 设置分区投或者尾部,隐藏默认间隔高度
1.隐藏尾部或者头部,配套使用
//注册头部id
tv.register(JYWithdrawalRecordSectionView.self, forHeaderFooterViewReuseIdentifier: sectionHeaderID) //设置高度;注意此处写死的。 如果用VFL 或者自适应,没效果的
tv.sectionHeaderHeight = 60//但是这里不好获取
//用下面方法
tv.sectionHeaderHeight = JYWithdrawalRecordSectionView().getLayoutSize().width
//隐藏尾部 这两行缺一不可, 不然显示默认的20高度的尾部view,隐藏头部同理
tv.tableFooterView = nil tv.sectionFooterHeight = 0.0001
2.显示自定义头部
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerV = tableView.dequeueReusableHeaderFooterView(withIdentifier: sectionHeaderID) as! JYWithdrawalRecordSectionView
headerV.updataData(data: dataArr[section])
headerV.clickSection = { [weak self] in
self?.handleSectionClick(section: section)
}
return headerV
}
3.
extension UIView{
/// 获得一个VFL 或者 layout的控件的size
func getLayoutSize() -> CGSize{
self.setNeedsLayout()
// 立马布局子视图
self.layoutIfNeeded()
return self.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
}
}
swift 分组tableview 设置分区投或者尾部,隐藏默认间隔高度的更多相关文章
- Swift - 设置tableView每个分区cell圆角
1.// 重新绘制cell边框 func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRow ...
- swift学习 - tableView自适应高度2(SnapKit Layout)
SnapKit是Swift中自动布局的框架,相当于Objective-C中的Masonry 下面是tableView自定义cell,使用SnapKit布局的效果图: 详细代码如下: TYCustomC ...
- iOS 11 导航栏 item 偏移问题 和 Swift 下 UIButton 设置 title、image 显示问题
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi ...
- 给tableView设置背景图片
经常遇到要给tableView设置背景图片的问题,但如果直接设置背景 backgroundView的话,背景图不会显示,原因是 tableView上的cell默认是不透明的颜色,所以解决方法是 让 ...
- swift关于UIView设置frame值的extension
swift关于UIView设置frame值的extension 使用 说明 1. 使用如上图,很简单,不再赘述 2. 在extension给添加的计算属性提供getter,setter方法即可 源码 ...
- iOS 给tableView设置contentInset不生效?
给tableView设置contentInset的时候如果tableView中内容比较多,超过一个屏幕,设置的contentInset是生效的,但是呢,如果页面内容比较少,我们会发现设置content ...
- RDLC报表 分组排序设置
原文:RDLC分组排序设置 RDLC中反复设置表的排序字段,设置数据源排序后绑定均无效. 需要在分组字段右击组属性中,修改对应的排序字段,即可.
- 设置Chrome和IE搜索栏的默认搜索引擎
由于本人比较喜欢用Google香港作为自己的默认搜索引擎,Chrome里面可以轻松设置. ======================== Chrome ======================= ...
- EFI/GPT探索(为何win7分区时创建100M隐藏分区)
EFI/GPT探索(为何win7分区时创建100M隐藏分区) 转自 http://blog.tomatoit.net/article.asp?id=348 EFI/GPT是新一代的固件/启动管理技术, ...
随机推荐
- 使用fpm 软件包打包
安装 sudo gem install --no-ri --no-rdoc fpm 简单使用 一个 redis的简单demo % ls src/redis-server redis.conf src/ ...
- SoundManager 2 / API Demo and Code Examples
http://www.schillmania.com/projects/soundmanager2/
- 用git,clone依赖的库
git clone https://github.com/influxdata/influxdb-java.git cd crfasrnn git submodule update --init -- ...
- Python 语言之 map/reduce
1.相关文献 大名鼎鼎的Google论文<MapReduce: Simplified Data Processing on Large Clusters> 对应的中文翻译<MapRe ...
- can't access lexical declaration `a' before initialization
<script type="text/javascript"> alert(a); let a=2; </script> 以上代码报错: Referen ...
- Scrapy学习篇(九)之文件与图片下载
Media Pipeline Scrapy为下载item中包含的文件(比如在爬取到产品时,同时也想保存对应的图片)提供了一个可重用的 item pipelines . 这些pipeline有些共同的方 ...
- SAS PROC PRINT 常用选项和语句说明
常用选项1.使用选项OBS=修改观测序号标签2.使用NOOBS选项不显示观测序号列3.使用ID语句在输出中取代观测序号列4.使用VAR选择输出的变量5.使用WHERE语句选择输出的观测6.使用数据集选 ...
- input输入完成后监听
clearTimeout(serachtimer); serachtimer=setTimeout(function(){ xxxxxxx //这里写处理的方法 },1000)
- SecureCR 改变背景色和文字颜色
1.打开SecureCR链接Linux服务器,Options->Session Options->Emulation->Terminal 选择Linux (相应的服务器系统)ANSI ...
- java.io.UnsupportedEncodingException
启动项目抛错: java.io.UnsupportedEncodingException: 1 at java.lang.StringCoding.decode(StringCoding.java:1 ...