CPTTextLayer - 多行 NSAttributedString

CPTTextLayer - multiple lines NSAttributedString

我正在尝试在 CPTAnnotation 中使用带有换行符的 NSAttributedString。 使用下面的代码时,仅显示 "firstString..." 。 删除 \n 符号时,两个字符串都正确显示(大小和颜色正确),但在一行中。

是否可以在注释中使用的 CPTTextLayer 上使用类似于标签的 numberOfLines=0(启用换行)的东西?

    NSMutableAttributedString* finalString = [firstAttrStr mutableCopy];
    NSMutableAttributedString *newLineAttrStr = [[NSMutableAttributedString alloc]initWithString:@"\n"];
    [finalLabel appendAttributedString:newLineAttrStr];
    [finalLabel appendAttributedString:secondAttrStr];

    //additional setup in here
    CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithAttributedText:finalLabel];

    textLayer.fill            = [CPTFill fillWithColor:[CPTColor whiteColor]];
    textLayer.cornerRadius    = 3.0;
    textLayer.paddingLeft     = 0.5;
    textLayer.paddingTop      = 0.5;
    textLayer.paddingRight    = 0.5;
    textLayer.paddingBottom   = 0.5;
    textLayer.hidden          = NO;

    //add shadow
    textLayer.masksToBounds = NO;
    textLayer.shadowOffset = CGSizeMake(0, 0);
    textLayer.shadowRadius = 5;
    textLayer.shadowOpacity = 0.3;

    _highlightAnnotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:plotSpace anchorPlotPoint:@[middlePoint, yAnnotationPosition]];
    [_highLightPlot addAnnotation:_highlightAnnotation];

    CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithAttributedText:finalString];
    _highlightAnnotation.contentLayer = textLayer;

看起来是这样的:

感谢Eric的建议,我解决了。 问题在于字体:Antenna。使用其他字体时,标注正常显示。