For example, the design draft is as follows
The overall text is left-aligned, but the last line of text is right-aligned
Main code: Set code using .alignment = NSTextAlignmentRight property of NSMutableParagraphStyle
descString = [NSString stringWithFormat:@"%@ \n\n %@\n%@",tagString,descString,source];
NSAttributedString *attr = getLineSpaceAttributedString(descString, 5, appFont(15, NO));
NSArray *array = [tagString componentsSeparatedByString:@"/"];
NSString *first = array[0];
NSString *change = array[1];
NSMutableAttributedString *strAtt = [[NSMutableAttributedString alloc] initWithAttributedString:attr];
[strAtt addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"0xffffff"] range:NSMakeRange(0, [tagString length])];
[strAtt addAttribute:NSFontAttributeName value:appFont(13, NO) range:NSMakeRange([first length], [change length]+1)];
///获取最后一行文字的range
NSRange authorRange = [descString rangeOfString:source];
NSMutableParagraphStyle *descStyle = [[NSMutableParagraphStyle alloc]init];
//设置居右对齐的样式
descStyle.alignment = NSTextAlignmentRight;
/// 设置最后一样的样式
[strAtt addAttribute:NSParagraphStyleAttributeName value:descStyle range:authorRange];