How do I set the height of tableHeaderView (UITableView) with autolayout?

后端 未结 12 1255
后悔当初
后悔当初 2020-11-27 10:23

I\'m been smashing my head against the wall with this for last 3 or 4 hours and I can\'t seem to figure it out. I have a UIViewController with a full screen UITableView insi

12条回答
  •  Happy的楠姐
    2020-11-27 11:12

    This solution works perfectly for me:

    https://spin.atomicobject.com/2017/08/11/swift-extending-uitableviewcontroller/

    It extends the UITableViewController. But if you are just using a UITableView, it will still work, just extend the UITableView instead of the UITableViewController. Call the methods sizeHeaderToFit() or sizeFooterToFit() whenever there is an event that changes the tableViewHeader height.

提交回复
热议问题