NSMutableAttributedString垂直对齐

Pav*_*rev 6 objective-c ios nsmutableattributedstring

我有一个文本的椭圆路径.对于填充路径,我使用了NSMutableAttributedString:

UIFont *font = [UIFont fontWithName:@"font name" size:15];
NSMutableParagraphStyle *mutParaStyle=[[NSMutableParagraphStyle alloc] init];

[mutParaStyle setAlignment:NSTextAlignmentCenter];
[mutParaStyle setLineBreakMode:NSLineBreakByWordWrapping];

NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObjectsAndKeys:font
                                 ,NSFontAttributeName,mutParaStyle ,NSParagraphStyleAttributeName,nil]; 

NSMutableAttributedString  *strText = [[NSMutableAttributedString alloc] initWithString:text attributes:attrsDictionary];
Run Code Online (Sandbox Code Playgroud)

但这只适用于水平文本对齐.我如何应用垂直对齐?

我有这个结果: 在此输入图像描述

但我需要这个: 在此输入图像描述

Hus*_*bir 0

但我尝试过垂直,它对我来说工作得很好,下面是屏幕截图,如果我错了,请告诉我,下面是附加的代码:--

在此输入图像描述

NSString *allTheText = [tv string];
NSFont *font = [NSFont fontWithName:@"Helvetica" size:24];
NSMutableParagraphStyle *mutParaStyle=[[NSMutableParagraphStyle alloc] init];

[mutParaStyle setAlignment:kCTTextAlignmentRight];
[mutParaStyle setLineBreakMode:NSLineBreakByWordWrapping];

NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObjectsAndKeys:font
                                 ,NSFontAttributeName,mutParaStyle ,NSParagraphStyleAttributeName,nil];

NSMutableAttributedString  *strText = [[NSMutableAttributedString alloc] initWithString:allTheText attributes:attrsDictionary];
[tv .textStorage appendAttributedString:strText];
Run Code Online (Sandbox Code Playgroud)