ios - Override spacing for a UIStackView -


i find uistackview perfect particular layout, except need variable spacing between arranged subviews. uistackview uses spacing property arrange views along axis, there way override these? example, love able add single manual constraint using visual format define required gaps, , somehow de-prioritize of stack view.

i forgo uistackview entirely of course, stack's ability give space between hidden subviews pretty painful replicate manually (adding , removing constraints based on views hidden, example). tried wrapping individual subviews in own stack views can use stack's layoutmargins add top-margin. requires managing wrapper-stack's own hidden state in addition of subview contains (surprisingly - me - uistackview arrangedsubviews hidden not automatically hidden itself, not yield spacing , margins own superview).

from ios 11 possible use:

stackview.setcustomspacing(spacing: cgfloat, after: uiview) 

Comments