Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UILabel paragraph text alignment

I am working on an Iphone application and I need to display a large text. I need it to have a paragraph alignment. Please refer to the picture below for explanation.

I tried to use UILabel and UITextView but couldn't find the property to do it.

enter image description here

like image 333
Y2theZ Avatar asked Sep 25 '12 08:09

Y2theZ


2 Answers

For ios > 7.1 just set textAligment property to NSTextAlignmentJustified , without any third-part libraries:

UILabel *label = [UILabel alloc] init];
label.textAligment = NSTextAlignmentJustified;
like image 68
Doro Avatar answered Sep 24 '22 10:09

Doro


UITextView and UILabel they dont provide such alignment. You can use UIWebview instead.

You can use <p style="text-align:justify">Your text goes here.</p>

This might be helpful.

like image 27
DivineDesert Avatar answered Sep 23 '22 10:09

DivineDesert