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.
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.
For ios > 7.1 just set textAligment property to NSTextAlignmentJustified , without any third-part libraries:
UILabel *label = [UILabel alloc] init];
label.textAligment = NSTextAlignmentJustified;
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.
Use TTTAttributedLabel NSAtributedString label which has UITextAlignmentJustify
yourTTTAttributedLabel.textAlignment = UITextAlignmentJustify;
Also another alternative is use OHAttributedLabel NSAtributedString label which has UITextAlignmentJustify
yourOHAttributedLabel.textAlignment = UITextAlignmentJustify;