How to set the height of table header in UITableView?

前端 未结 17 1422
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 22:00

I have gone through Apple docs about UITableView class and delegate reference but couldn\'t find the way to set the table header height explicitly.

I set Table cell

17条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 22:36

    Just create Footer Wrapper View using constructor UIView(frame:_) then if you are using xib file for FooterView, create view from xib and add as subView to wrapper view. then assign wrapper to tableView.tableFooterView = fixWrapper .

        let fixWrapper = UIView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, 54)) // dont remove
        let footer = UIView.viewFromNib("YourViewXibFileName") as! YourViewClassName
        fixWrapper.addSubview(footer)
        tableView.tableFooterView = fixWrapper
        tableFootterCostView = footer
    

    It works perfectly for me! the point is to create footer view with constructor (frame:_). Even though you create UIView() and assign frame property it may not work.

提交回复
热议问题