zoukankan      html  css  js  c++  java
  • 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)
        }
    }
    

      

  • 相关阅读:
    Java实现 蓝桥杯VIP 算法训练 字符删除
    Java实现 蓝桥杯VIP 算法训练 字符删除
    Java实现 蓝桥杯VIP 算法训练 字符删除
    Java实现 蓝桥杯VIP 算法训练 字符删除
    Java实现 蓝桥杯VIP 算法训练 字符删除
    Java实现 蓝桥杯VIP 算法训练 字符串编辑
    Java实现 蓝桥杯VIP 算法训练 字符串编辑
    Java实现 蓝桥杯VIP 算法训练 字符串编辑
    Java实现 蓝桥杯VIP 算法训练 字符串编辑
    Java实现 蓝桥杯VIP 算法训练 字符串编辑
  • 原文地址:https://www.cnblogs.com/qingzZ/p/10450791.html
Copyright © 2011-2022 走看看