UITableView Not Respecting heightForHeaderInSection/heightForFooterInSection?

后端 未结 9 1668
臣服心动
臣服心动 2020-12-09 02:57

I have a UITableView where in some instances, certain sections have zero rows. My goal is that when this is true, I don\'t want any wasted space in the table view, it should

9条回答
  •  不思量自难忘°
    2020-12-09 03:50

    I had a similar problem: I was loading a UITableView from a XIB (same as you), and supplied a 0 height for some section footers with tableView:heightForFooterInSection (same as you), but the value was ignored.

    The fix was simple: also set the footer height to 0.0 in the XIB. (In Interface Builder select the Table View, press Command-3 to view the Size Inspector, look for the footer height field near the top)

    Once that was done it obeyed the custom footer height as expected. (Perhaps it treats the XIB footer height as a minimum?)

提交回复
热议问题