Reputation: 3212
I'm developing an app in iOS 6 and using Xcode 4.5.2.
I have a simple UIView which contains some text according to localizable string. Well, according to displayed language, the number of lines of the text is changing.For exemple, in English, there is two lines, but in Turkish, it takes just one line.
I'm also supposed to center text alignment. Well, right now i'm able to accomplish it, but i'm using two different UILabel and i've set their text manually. So, it doesn't work if i change the displayed language of the text
So,
1- What is the best way to handle this kind of alignment issue ?
2- Suppose that i use UILabel
, well how can i make a new line to be able to have the output as shown in the pic. None of the line breaking mode seems to work. Same question if i use UITextView
?
Thanks in advance
Upvotes: 1
Views: 2135
Reputation: 39998
Do these thing
\n
character in you string where you want line break.UILabel
.By default when text reaches the width of the lablel it moves to next line but what you want that before it reaches to it's width it should move to next line which is not possible by setting the properties of UILabel
. For that you have to set new line character in your string.
Upvotes: 1
Reputation: 5489
Have you tried using the UILabel
Instance method textRectForBounds:limitedToNumberOfLines:
From the documentation:
The value 0 indicates there is no maximum number of lines and that the rectangle should encompass all of the text.
Upvotes: 0