class headerView: UIView {

    var whiteView = UIView().then {
$.backgroundColor = UIColor.red
} override init(frame: CGRect) {
super.init(frame: frame) addSubview(whiteView)
whiteView.snp.makeConstraints { (make) in
make.left.top.right.equalToSuperview()
make.bottom.equalTo(-)
make.height.equalTo()
}
} required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
} override func layoutSubviews() {
super.layoutSubviews()
}
}

设置 tableHeaderView 的高度

        let v = headerView()
let height = CGFloat(v.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height)
v.frame = CGRect(x: , y: , width: kScreenWidth, height: height)
tabelView.tableHeaderView = v

swift 自动布局设置 tableview 的 tableHeaderView 的高度的更多相关文章

  1. 【swift,oc】ios开发中巧用自动布局设置自定义cell的高度

    ios开发中,遇到自定义高度不定的cell的时候,我们通常的做法是抽取一个frame类,在frame类中预算好高度,再返回. 但是苹果出来自动布局之后...春天来了!!来看看怎么巧用自动布局设置自定义 ...

  2. Swift - 设置tableView每个分区cell圆角

    1.// 重新绘制cell边框 func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRow ...

  3. UITableView:改变 TableHeaderView 的高度

    参考:http://stackoverflow.com/a/526825 有这么一种需求,在列表顶端显示一些别样的数据,而这个别样的数据则需要通过一个别样的 View 来展现,它便是 UITableV ...

  4. Swift4 - 动态计算UITableView中tableHeaderView的高度 - 获取子控件高度和宽度

    核心 : /// 获取 子控件高度 func sizeHeaderToFit(view:UIView) { view.setNeedsLayout() view.layoutIfNeeded() le ...

  5. Swift - 实现点击cell动态修改高度

    Swift - 实现点击cell动态修改高度 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TapCellAnimationC ...

  6. Swift - 自动布局库SnapKit的使用详解4(样例1:实现一个登录页面)

    前面的几篇文章讲解了自动布局库SnapKit的使用方法.本文通过一个完整的样例(登录页面)来演示在实际项目中如何使用SnapKit来实现自动化布局的.1,效果图如下

  7. 第19月第20天 UITableView:改变 TableHeaderView 的高度 获取目录大小

    1.UITableView:改变 TableHeaderView 的高度 CGRect newFrame = headerView.frame; newFrame.size.height = newF ...

  8. IOS8 设置TableView Separatorinset 分割线从边框顶端开始

    IOS8 设置TableView Separatorinset 分割线从边框顶端开始   在ios8上 [TableViewsetSeparatorInset:UIEdgeInsetsMake(0,0 ...

  9. jQuery获取或设置元素的宽度和高度

    jQuery获取或设置元素的宽度和高度: 可使用以下3种方法: 1,jQuery width() 和 height() 方法: 2,innerWidth() 和 innerHeight() 方法: 3 ...

随机推荐

  1. mysql------Windows7 64bit安装教程------下载mysql

    .1.进入官网的下载位置,https://dev.mysql.com/downloads/installer/: 2.选择“Windows”; 3.点击"MySQL Installer&qu ...

  2. More than one file was found with OS independent path 錯誤

    More than one file was found with OS independent path 'lib/armeabi/libmrpoid.so',. 翻譯過來就是:在操作系統的獨立目錄 ...

  3. java——collection总结

    Collection 来源于Java.util包,是非常实用常用的数据结构!!!!!字面意思就是容器.具体的继承实现关系如下图,先整体有个印象,再依次介绍各个部分的方法,注意事项,以及应用场景.   ...

  4. gentoo 画框架图,流程图

    需要话框架图,流程图的时候,只需要安装 dia 软件就可以了.

  5. djangorestframework-jwt自带的认证视图进行用户登录验证源代码学习

    Django REST framework JWT djangorestframework-jwt自带的认证视图进行用户登录验证源代码学习 SECRET_KEY = '1)q(f8jrz^edwtr2 ...

  6. 什么是pyc文件,Python

    pyc文件就是 Python 程序编译后得到的字节码文件 (py->pyc).pyc文件一般由3个部分组成:最开始4个字节是一个Maigc int, 标识此pyc的版本信息, 不同的版本的 Ma ...

  7. 啊哈算法第四章第二节解救小哈Java实现

    package corejava; public class FourTwo { static int m;//(m,n)为几行几列 static int n; static int p;//(p,q ...

  8. Ajax需要带头信息跨域问题的解决

    $.ajax({ type:"get", url:"http://localhost:8082/index/getMsg", dataType:'json', ...

  9. linux程序一般设置

    看canal的时候看了下deploy的脚本,发现很多系统都大同小异 如果是需要debug,就需要开启调试端口 if [ "$1" = "debug" ]; th ...

  10. 1503.02531-Distilling the Knowledge in a Neural Network.md

    原来交叉熵还有一个tempature,这个tempature有如下的定义: \[ q_i=\frac{e^{z_i/T}}{\sum_j{e^{z_j/T}}} \] 其中T就是tempature,一 ...