How to force trailing spaces in a right-aligned UITextView?

爱⌒轻易说出口 提交于 2019-12-13 13:12:40

问题


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?

来源:https://stackoverflow.com/questions/23296012/how-to-force-trailing-spaces-in-a-right-aligned-uitextview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!