zoukankan      html  css  js  c++  java
  • 自定义 tableviewheader 高度显示不正常

    BUG : 自定义的Xib View设置为tableview分区头的时候  tableview 如果是plain 模式, 设置 sectionHeader  sectionHeader会成为悬浮窗, 不跟随cell 一起滑动,

    并且 高度会出现问题

         let headerV = JYSetPersonalSexView.loadFromNib()

         headerV.delegate = self

         headerV.configData(str:shopModelAndPersonalModel.personalModel.shopOwnerSex)

         tableview.tableHeaderView = headerV

        tableview.sectionHeaderHeight = JYSetPersonalSexView.viewHeight()

     

     
    解决 改为group模式, 实现下列方法 正常显示 分区头高度, 分区头也 和cell 一起滑动

        func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

     

            let headerV = JYSetPersonalSexView.loadFromNib()

            headerV.delegate = self

            headerV.configData(str:shopModelAndPersonalModel.personalModel.shopOwnerSex)

            return headerV

        }

     

        func numberOfSections(in tableView: UITableView) -> Int {

            return 1

        }

        

        func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {

            return section == 0 ? JYSetPersonalSexView.viewHeight() : 0.00001

        }

     

        func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {

            return 0.00001

        }

  • 相关阅读:
    MVC WebApi的两种访问方法
    MVC CRUD 的两种方法
    MVC EF 导航属性
    MVC EF两种查询方法
    MVC WebApi
    POJ 1511 Invitation Cards ( 双向单源最短路 || 最小来回花费 )
    POJ 2502 Subway ( 最短路 && 最短路建图 )
    POJ 3660 Cow Contest ( 最短路松弛思想应用 && Floyd求传递闭包 )
    POJ 1502 MPI MaeIstrom ( 裸最短路 || atoi系统函数 )
    POJ 3259 Wormholes ( SPFA判断负环 && 思维 )
  • 原文地址:https://www.cnblogs.com/qingzZ/p/9223126.html
Copyright © 2011-2022 走看看