Is there any way to 'justify' the text in a UITextView
in an iOS app?
Asked
Active
Viewed 1,163 times
1
-
Not out-of-the-box. See duplicate post: http://stackoverflow.com/questions/402339/getting-justified-text-in-uitextfield. – petert Jul 26 '11 at 07:57
1 Answers
1
No that's not possible in a UITextView. There are two ways to achieve this.
- Write a method that adusts the text with spaces in a way that it fits the textview exactely
- Use CATextLayer. That class has a property to set the alignment to Justifiy.
I hope this helps you out.
Sandro Meier

Sandro Meier
- 3,071
- 2
- 32
- 47
-
-
Thanks. I did it myself. But if the layer has not a big width, the result looks ugly... – Sandro Meier Jul 26 '11 at 08:25
-
I followed this approach and did it view `UILabel` and `drawRect:` http://furbo.org/2008/10/07/fancy-uilabels/ – petert Jul 26 '11 at 11:37