2

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 e.g. 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

Community
  • 1
  • 1
Boris Prohaska
  • 912
  • 6
  • 16
  • That should work unless the image view has another constraint that keeps it from moving down. Do you get any warnings in the log? And what are "Siblings and Ancestors" and "Descendants", I've never seen those settings – rdelmar Dec 17 '12 at 20:21
  • Yeah - i thought so too, the image view has no constraint that keeps it from moving down. There are no logs, and `[view hasAmbiguousLayout]` returns `NO`. You can open this settings on the right button at the lower right hand corner in IB. See also here at the accepted answer: http://stackoverflow.com/questions/12789013/ios-multi-line-uilabel-in-auto-layout – Boris Prohaska Dec 17 '12 at 20:31
  • How is the label positioned if you don't have any Space To Superview constraints? I tried this with my label having constraints to the top and both sides, while the image view had only explicit width and height, center x, and the vertical spacing constraint to the label -- that wokrd fine. – rdelmar Dec 17 '12 at 21:00
  • Sorry - I have edited my question. The top `UILabel` has a "1000" Top Space to Superview constraint. – Boris Prohaska Dec 17 '12 at 21:14
  • @rdelmar Those "siblings and ancestors" and "descendants" options are available in Interface Builder in that second group of button in the lower right corner of the workspace that includes the "align" button and the "pin" button (the I-beam shaped button). It's the third button in that group. It's discussed roughly a third of the way down in [this article](http://blogs.captechconsulting.com/blog/raymond-robinson/ios-6-tutorial-series-dynamic-interfaces-auto-layout). – Rob Dec 18 '12 at 15:49

1 Answers1

1

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

View 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]
Rob
  • 415,655
  • 72
  • 787
  • 1,044