Trying to achieve UIStackView with 2 labels for iPhone and 3 labels for iPad using size classes.
View hierarchy
Default size class
[UIStackView]
[UILabel 1] [UILabel2]
[UIStackView]
RxR size class
[UIStackView]
[UILabel 1] [UILabel2] [UILabel3]
[UIStackView]
It looks exactly as expected in Storyboard as you can see in the above screenshots but on simulator iPad view is messed up.
iPhone Output (okay)
iPad Portrait Output (messed up)
iPad Landscape Output (messed up)
What's happening in iPad?? Is it a bug or I'm missing something? Thanks.
I have created a sample project.
Follow below steps to achieve your requirements :
top,leading, =trailing and fixed height
Equal width
attribute inspector
click on +
button beside installed
and select Regular for both width and height. It will add regular,regular variation and uncheck the checkbox for that R,R variation
. Refer below screen shot for better understanding,And you are done! now you your center label will not show in iPad and every label will be displayed in iPhone!
See below result screenshot of iphone and ipad
in my case!
iPhone :
iPad :
Update :
If you want two to hide label in iPhone and show in iPad then add one more variation : Compact Width Regular Height
for middle label and uncheck the checkbox to uninstall. Refer below screenshot,