ios - swift not sure on layoutIfNeeded setNeedsUpdateConstraints or updateConstraints setNeedsLayout -


i calling api. depending on json data modyfing view controller in viewdidload() in order change views design display given data best way possible.

what hide uiviews , set constraints .active = false changing of constraint eg:

let nocbutton = nslayoutconstraint(item: alisttop, attribute: nslayoutattribute.centery, relatedby: nslayoutrelation.equal, toitem: alistbottom, attribute: nslayoutattribute.centery, multiplier: 1, constant: 0)         view.addconstraint(nobidbutton) 

then before closing viewdidload() change/disable constraints call view.layoutifneeded()

so question is,

if change/disable constraints or hide uiview, should call view.layoutifneeded() afterwards?

also, need call view.layoutifneeded() right after every change or can call once before closing viewdidload()?

i dont errors in console either way, want make sure doing right way. noted functions updateconstraints layoutifneeded seems work, tho im not 100% sure difference

thanks in advance,

i call view.setneedsupdateconstraints(). after viewdidload(), viewwilllayoutsubviews() should called automatically. should need @ moment.

if need force view update call view.layoutifneeded(), if want make set of changes , have them applied @ next layout pass call view.setneedslayout() @ end of changes.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -