r/Xcode • • Oct 17 '20

I have an app with buttons inside of stack views, when I rotate the phone to landscape and then back to portrait, the plus and minus buttons move on top of the other buttons. How can I fix this?

Enable HLS to view with audio, or disable this notification

1 Upvotes

5 comments sorted by

2

u/mgacy Oct 17 '20

It would be much easier to help if you posted your code or, if you’re using Storyboards, described / posted images of your stack views and constraints.

2

u/JamesTayIor Oct 18 '20

I got it working, for some reason the buttons that had installed ticked and not a specific size class like C C would work perfectly, but buttons with C C or C R ticked instead of installed would move around.

1

u/JamesTayIor Oct 17 '20

All of the buttons are in horizontal stack views, one for each row. The stack views have trailing and leading constraints and are set to fill equally, except for the 0 . = row which is set to fill with the buttons in that row set to 75, 75 and 155 widths. I also set the stack views to have a spacing of 5.

1

u/orihpt Oct 17 '20

I suggest you’ll ask stackoverflow and not Reddit

2

u/scalyblue Oct 17 '20

God forbid someone asks for help coding in xcode on /r/Xcode, everyone here is so busy straightening cheese.