I'm using UIStackView
for layouting in one of my tableview cell xibs to make resizing easier, and I'm also using size classes as there are layout differences between phones and tablets.
Due to some reason, I have to use a different stackview for each size class. Say stackview1
for iPhones and stackview2
for iPads. Now I have moved label1
into stackview1
in iPhone size class, switched to iPad size class and wanted to move label1
to stackview2
from stackview1
(which is greyed out). But once I do this and switch back to iPhone size class, Label1
is moved out of stackview1
and the iPhone layout screws up.
Wondering if anyone has encountered this before and got any solutions?
UPDATED
To clarify further,
I implemented the following two layouts purely via constraints and I was convinced by by colleagues that layout using UIStackView can be easier to adapt to UI changes. For example, in the layouts below, there is a distance constraint (12) between
label1
andlabel3
, if I wantlabel3
to move up oncelabel1
andlabel2
are hidden/nil, I will have to manually set the distance constraint to 0. While if viaUIStackView
, setlabel1
andlabel2
as hidden and we are all set. This is just an example, there are much more changes like this.The reason why I need different
UIStackView
for sizes class is because of the design differences.