Is there a way to use non breaking spaces in UILabel text?
For example, I have label with 2 lines and line breaking mode set to word wrap. The content for this label is read from database, where it's stored as a string. Now sometimes my text in label looks like that:
lorem ipsum some text
1
but I want to display it like that:
lorem ipsum some
text 1
so basicly, I need to force non breaking space between 'text' and '1'.
I've found some solution here, but I think it could work when the text is entered in source code file. In my case the text is in database.
Any suggestions?
In Inspector set number of lines for Label as 3 or 4 What ever you require Then the Content will be displayed in multiple lines.
You may need to implement a custom word-wrapping function.
or something like that.
If you want to get this to work in a .strings file, you can type OPTION + SPACE instead of a regular space.
.strings files are usually UTF-8 encoded, so if you open it in Hex view, you will see "C2 A0" in place of the special space character.