5

I have a UITextView that can be either left-aligned, right-aligned or centered. I noticed that if I right-align the textView, any trailing spaces in any of the lines of text in the textView are ignored. This doesn't happen for leading spaces when left-aligning.

Visually this is what happens (with '-' to visualize a space):

Left-aligned:

-some-text-

Same text right-aligned:

--some-text

Adding more text, brings back the trailing space in the correct position:

-some-text-b

I can't work out why this is or how I can force right-aligned text to present the trailing spaces on the right-hand side. Any suggestions?

adriaan
  • 1,574
  • 14
  • 33

0 Answers0