ios - Swift - How dynamically fixed UITableViewHeaderFooterView height size? -


i have tried below lines of code, doesn't work correctly. wonder how can provide case header or footer programmatically, may using autolayout don't know 1 solved problem. i'm using xib file both of uitableviewheaderfooterview.

if explain great.

override func viewdidlayoutsubviews() {     super.viewdidlayoutsubviews()      // dynamic sizing footer view     if let footerview = tableview.tablefooterview {         let height = footerview.systemlayoutsizefittingsize(uilayoutfittingcompressedsize).height         var footerframe = footerview.frame          if height != footerframe.size.height {             footerframe.size.height = height             footerview.frame = footerframe             tableview.tablefooterview = footerview         }     }  } 

the uitableview calculates headerfooter before displayed, can't update height without calling reloaddata() again.

have tried use autolayout on headerfooterviews? set view xib right constraint, , then:

self.tableview.estimatedsectionheaderheight = 100 self.tableview.sectionheaderheight = uitableviewautomaticdimension 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -