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)
        }
    }
    

      

  • 相关阅读:
    Ubuntu搭建FTP服务器
    【wireshark】wireshark 出现There are no interfaces on which a capture can be done.的解决方法
    那些强悍的PHP一句话后门
    Ubuntu下SSH设置
    Servlet&JSP中的知识点
    String s=new String("abc")创建了几个对象?
    JavaEE的13种核心技术
    ++i和i++
    构造方法
    TCP/IP
  • 原文地址:https://www.cnblogs.com/qingzZ/p/10450791.html
Copyright © 2011-2022 走看看