I have six labels here, every two labels are stack in a horizontal view, and all horizontal views are stack in a vertical view, as show below
Here is what I want: I'd like to set Label1
's width 30% of Label2
regardless of each label's content
The outer stack view is set as Aligment:Fill, Distribution:Fill Equally
All inner stack view are set as Aligment:Fill, Distribution:Fill
I have set Label1
's hugging to 250, and Label2
's as default (so does the others).
And I am trying to set the width by Equal Widths in pic 2. But it is unselected
what should I do about this? Preferring doing all the work in the storyboard, but working around in code is ok too.
Solution: Just need to select both label to add the constraint, as Below Solution image
IMO, Stack View wont allow to give some fix frame size of the views inside it, we can somewhat control it using available properties.
Stack Views are meant for similar type content to be confined inside one view.
Option:
0.30
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.