Reputation: 1005
I'm very new to iPhone programming. actually i've started to write a small app and I'm trying to set a text that contains a new line character to a label.
I have set the label properties to 0 number of lines and selected word wrap.
my text looks like this : @"ABCD\nEFGH\nIJK"
instead of printing on a new line on the label it truncates the string after the first new line character. any ideas?
Upvotes: 0
Views: 67
Reputation: 104082
If auto layout is on, and you don't add any explicit constraints, the system adds them for you. If you look at the size inspector when you haven't added ay constraints yourself, it says this,
The selected views have no constraints. At build time, explicit left, top, width, and height constraints will be generated for the view.
Having that height constraint is what's probably causing your problem. Add constraints to position the view horizontally and vertically, but don't add any width or height constraints, and that should solve your problem. The system will adjust the width of the label to match your longest line.
Upvotes: 1