简体   繁体   中英

Auto layout not working on multiline UILabel

I have the following cell:


(source: qwuh.com )

The top "Loading..." is a UILabel with its "Lines" set to 0. I can't truncate the content, so it must resize accordingly and push everything else under it down.

What usually happens is that I indeed get a eg 3 line UILabel , but it overlaps the image view. I don't understand this since i have a "1000" user constraint for the vertical spacing between the UILabel and the UIImageView . I have set both "Siblings and Ancestors" and "Descendants" on in IB.

None of this views have any of the "...Space to Superview" set in IB, except of the first "Loading..." UILabel on the top. I really tried everything but it always behaves wrong.

What should I do, so that setting the text property of the top UILabel will indeed push down the image view and everything else?

Thank you

Can you share your constraints with us? I created a scene with the following constraints:

查看约束

With this configuration, when I set that top label to be a really long string, it grows and everything below shifts down.

Perhaps you can share your constraints with us and we can see if anything leaps out at us.

Also, I know that you said that there were no ambiguous constraints, but it might be worth checking the debugger with the following and see what it says:

po [[UIWindow keyWindow] _autolayoutTrace]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM