Reputation: 11
If you have a UILabel with numberOfLines set something > 1 and try the follwoing:
UILabel *lbl;
lbl.text = "line1\nline2"; // works and displays 2 lines
line1
line2
lbl.text = "\nline2"; // works in iOS 6 and shows an empty line and a second line with line2
does not show anything in iOS 7
Under iOS6 you get: > >
line2 (with an empty first line)
Any idea why a newline character at the beginning of a Label-text spoils the UILabel since iOS 7?
Upvotes: 0
Views: 757
Reputation: 999
I was facing the same issue and how I fixed it ?? I added a blank space before new line character i.e "\n" like @" \n hi this is sample code." and it worked fine then. Try it Plzz.
Upvotes: 4
Reputation: 1215
I think you should to add this:
lbl.numberOfLines = 0;
to enable multiline. It works differently on 6 and 7 ios.
Upvotes: 0