Nested UIStackViews Broken Constraints

后端 未结 7 625
故里飘歌
故里飘歌 2021-01-31 02:59

I have a complex view hierarchy, built in Interface Builder, with nested UIStackViews. I get \"unsatisfiable constraints\" notices every time I hide some of my inner stackviews.

7条回答
  •  花落未央
    2021-01-31 03:42

    Ideally we could just set the priority of the UISV-spacing constraint to a lower value, but there doesn't appear to be any way to do that. :)

    I am having success setting the spacing property of the nested stack views to 0 before hiding, and restoring to the proper value after making it visible again.

    I think doing this recursively on nested stack views would work. You could store the original value of the spacing property in a dictionary and restore it later.

    My project only has a single level of nesting, so I am unsure if this would result in FPS problems. As long as you don't animate the changes in spacing, I don't think it would create too much of a hit.

提交回复
热议问题