ios - autolayout constraints in nib not honored for UITableViewHeaderFooterView -


i have uitableview several columns of data. reusable cells loaded xib file has appropriate labels , autolayout constraints. works perfectly; table columns laid out correctly on different devices , when devices rotated.

the problem having trying create table footer show totals of columns in table.

i created xib file same autolayout constraints cell xib file , loading in tableview.viewforfooterinsection same way did cells. required, using subclass of uitableviewheaderfooterview instead of uitableviewcell.

the awakefromnib method in uitableviewheaderfooterview subclass sets background color, can see correct size on devices/orientation, labels footer xib file not getting laid out match table cells.

the autolayout constraints footer xib file not being honored. when set different background color in footer xib file, table footer shows background color length of xib's view.

i'm new of technology , appreciate in resolving incredibly frustrating issue.

is there way use autolayout uitableviewheaderfooterviews loaded nibs?

you should call setneedsupdateconstraints() update view.

from apple documentation

controls whether view’s constraints need updating. when property of custom view changes in way impact constraints, can call method indicate constraints need updated @ point in future. system call updateconstraints part of normal layout pass. updating constraints @ once before needed ensures don’t needlessly recalculate constraints when multiple changes made view in between layout passes.

also, can update view throw layoutsubviews()

lays out subviews. default implementation of method nothing on ios 5.1 , earlier. otherwise, default implementation uses constraints have set determine size , position of subviews. subclasses can override method needed perform more precise layout of subviews. should override method if autoresizing , constraint-based behaviors of subviews not offer behavior want. can use implementation set frame rectangles of subviews directly. should not call method directly. if want force layout update, call setneedslayout method instead prior next drawing update. if want update layout of views immediately, call layoutifneeded method.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -