0

Previously, I asked about using constraint layout to put two NSTableView side-by-side. Side-by-side NSTableView using StackView and Constraints Thanks to Willeke's help, I was able to achieve this using only constraints, and no StackView.

The recommendation there was:

[...] Xcode is buggy. Avoid resizing the window and/or solve layout issues by updating the frames (in Xcode 9: menu Editor -> Resolve Layout Issues -> Update Frames).

I'm still having trouble with that, unfortunately. When I run my app, it now looks fine. However, in Interface Builder, clicking "Update Frames" actually makes the layout progressively worse, such that I have to Git reset to get back to a reasonable layout. I'm worried that later, when I actually need to update my view, I will be in trouble because I am unable to touch it without breaking it.

I've tried to illustrate the issue:

short clip showing me repeatedly clicking Update Frames

I'm unsure if it's helpful, but here is my list of constraints:

list of constraints on main View object

What could be wrong here? Have I forgotten some obvious constraint?

RogerTheDragon
  • 267
  • 1
  • 10
  • Is the problem caused by the table views or by other layout issues? Is it possible to create a small test project with only the views causing the problem? – Willeke Jun 17 '21 at 09:48
  • I probably should make a minimal project again to be completely sure, but I built up this view by first making all the other components work well, then finally adding the NSTableViews one by one, and trying to make their constraints layout work. The troubles started when I added the NSTableViews. – RogerTheDragon Jun 17 '21 at 11:08
  • I tried to reproduce the issue but I get errors about missing constraints and the layout doesn't look the same. Maybe the centerX alignment is the problem. Try replacing the inner side constraints (centerX = queue table.trailing + 4 and search result table.leading = centerX + 4) by a space constraint and equal widths (search result table.leading = queue table.trailing + 8 and search result table.width = queue table.width). – Willeke Jun 17 '21 at 13:06
  • OK, well, I can't say it's perfect, but this particular issue is solved – thank you In the end I used your tip (equal widths and a space), although mostly it seemed that removing "minimum content size" from the NSWindow was the key. Then, pressing Update Frames repeatedly first cycled more and more broken (as before) then finally, on the last iteration, settles on a reasonable layout! Finally! Frustratingly, when opening the XIB the first time it seems it thinks the layout is broken, but if I cycle through the Update Frames rigmarole it settles down, and is unchanged compared to Git! – RogerTheDragon Jun 18 '21 at 01:55

0 Answers0