0

I want to justify a paragraph using UITextView in an iPhone using xCode.

What property should I change to do this.

Thanks In Advance

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
yohan.jayarathna
  • 3,423
  • 13
  • 56
  • 74

2 Answers2

1

Photo says it all. You could use the Alignment control to left, center or right justify text.

By the way this is got when you go to Interface builder, select that UItextView & then set these properties...

From code you could do - [yourTextView setTextAlignment:<#(UITextAlignment)#>

enter image description here

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
  • thanx for your concern. But I want to justify the paragraph(check this image) http://www.homeandlearn.co.uk/word2007_2010/images/clipart/justify.gif – yohan.jayarathna Aug 09 '11 at 12:13
  • I want to make paragraph like this. http://dev.opera.com/articles/view/11-typography-on-the-web/02-rivers.gif – yohan.jayarathna Aug 09 '11 at 12:15
  • in iOS for `UITextView` you have only 3 ways to align text as far as i know. Not sure what the 4th is? is it Microsoft word? – Srikar Appalaraju Aug 09 '11 at 12:18
  • yes it is ms word image which for explain my requirement :) check second image it shows the way I want to display my paragraph! – yohan.jayarathna Aug 09 '11 at 12:20
  • try the default text alignment iOS supports, maybe that will suffice? If there's no support,what can one do... Not sure you would want to go down the road to do your own layout handling for UITextView... – Srikar Appalaraju Aug 09 '11 at 12:23
0

The correct way To justify a paragraphy is:

    YOURTEXTVIEW.textAlignment = NSTextAlignmentJustified;
nedaRM
  • 1,837
  • 1
  • 14
  • 28
Manju
  • 4,133
  • 2
  • 19
  • 12