How to right-justify UILabel text?
thanks
Here is:
be careful if full justify needs to be applied, firstLineIndent
should not be zero.
NSMutableParagraphStyle* paragraph = [[NSMutableParagraphStyle alloc] init];
paragraph.alignment = NSTextAlignmentJustified;
paragraph.baseWritingDirection = NSWritingDirectionRightToLeft;
paragraph.firstLineHeadIndent = 1.0;
NSDictionary* attributes = @{
NSForegroundColorAttributeName: [UIColor colorWithRed:0.2 green:0.239 blue:0.451 alpha:1],NSParagraphStyleAttributeName: paragraph};
NSString* txt = @"your long text";
NSAttributedString* aString = [[NSAttributedString alloc] initWithString: txt attributes: attributes];