5

I am designing a view controller in Interface Builder and have a stack view. After any action (e.g. moving any object a tiny bit, or changing a constraint by 1px) the whole stack view collapses horizontally, messing up all the layout. Then, when I take any other action (e.g. change another constraint, or even the same one, doesn't matter) it gets back to its original correct layout.

Here is a screenshot of the correct layout:

enter image description here

Here is the same view, just after changing literally anything:

enter image description here

When I change anything again, it gets fixed (back to correct layout), and gets messed up again when I change something else, going forever like that. There aren't any autolayout issues in the inspector. Also, after this problem started, I've set all views' hugging and compression resistance constraints to 1000, but no avail. What might be causing this? I am on Xcode 9.2.

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • 1
    I have the same problem, but haven't been able to find a fix. It's impossible to work with the stackview in Interface builder, as it constantly resizes and disappears. – rodskagg Feb 19 '18 at 13:45
  • @andlin I've gave up stack view completely, as it also had TERRIBLE scrolling performance in my scroll view. while the idea of stack view is tempting, the current implementation is too buggy and slow to be used in many projects. – Can Poyrazoğlu Feb 19 '18 at 19:35

1 Answers1

5

Right after posting this, I've noticed something:

If I give a preferred explicit width (anything greater than zero, doesn't matter if 1 or 10000) the problem goes away:

enter image description here

enter image description here

Though I still don't know why it was collapsing the whole stack view after each action.

However, it fixed the issue.

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • 1
    Thanks! this seems to work, though having to give preferred width is weird. And the jumping of stack view is so annoying ;( – prad Mar 14 '18 at 03:51
  • 1
    @prad yeah it's definitely a bug at Apple's side, but still, it saves the day at least :) – Can Poyrazoğlu Mar 14 '18 at 07:29