Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Space at end of text not visible in right-aligned UITextField

I have a right-aligned UITextField. Initially spaces did not appear at the end of the text when editing. This I solved using this: replacing @" " with the non-breaking "\u00a0".

The above, however, only shows the space while editing the text field.

How do I also make spaces at the end of the text visible when the text field is not being edited?

like image 321
meaning-matters Avatar asked Mar 06 '14 18:03

meaning-matters


1 Answers

Seems like triazotan has a solution involving replacing non breaking space for space https://stackoverflow.com/a/20129483/1247248

rednaw has some potentially better version, but someone was complaining of weird side effects https://stackoverflow.com/a/22512184/1247248

I ended up going with the version of this solution suggested by meaning-matters https://stackoverflow.com/a/22211018/1247248 and that worked for me.

EDIT

It looked like a good fix but I found a problem. When you select inside the text and type the cursor jumps to the end of the line. Turns out I should have gone with triazotan's version https://stackoverflow.com/a/20129483/1247248

like image 79
Marc Avatar answered Oct 19 '22 23:10

Marc