I'm trying to put multiline UILabels
into the vertical UIStackView
and then put this UIStackView
into the horizontal UIStackView
alongside other views ( UIImage
and UIButton
).
My problem is that number of lines of the label is always one. Is it possible to force the label become multiline without specifying the width of the vertical stack?
Is it possible to force the label become multiline without specifying the width of the vertical stack?
No, the base behind wrapping is a specified width (static/proportional), so you should either set a width for the vertical stack or the label
I am not 100% sure of what you are trying to achieve. But from what I understand, when vertical stack view is embedded again in the horizontal stack View. The horizontal stackView property along with its constraints determine how to set up the position specially stackView alignment and distribution.Even inside the stack view you can set your label to width to be of maximum constant. As I am not sure of the exact scenario, maybe you could simply add a line break \n to your UILabel text.
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.