首页 > 解决方案 > 纹理 ASTextNode 边框和阴影属性不起作用

问题描述

这是我的代码,我ASTextNode在我的超级视图上放了一个并应用了一些属性,但其中一些不起作用,例如ASTextBorder.


    CGFloat top = 10;
    CGFloat bottom = -1;
    UIEdgeInsets insets = UIEdgeInsetsMake(top, -10, bottom, -10);
    CGFloat radius = font.pointSize / 2;
    mps.alignment = textAlignment; //NSMutableParagraphStyle


    ASTextNode *textNode = [ASTextNode new];
    ASTextBorder *asBorder = [ASTextBorder borderWithFillColor:UIColor.redColor cornerRadius:radius];
    asBorder.insets = insets;
    NSDictionary *attributes = @{
                                 NSForegroundColorAttributeName: UIColor.whiteColor,
                                 NSFontAttributeName: font,
                                 NSStrokeWidthAttributeName: @(-5),
                                 NSStrokeColorAttributeName: UIColor.blackColor,
                                 NSParagraphStyleAttributeName: mps,
                                 ASTextBorderAttributeName: asBorder,
                                 };
    textNode.attributedText = [[NSAttributedString alloc] initWithString:text attributes:attributes];
    textNode.textContainerInset = UIEdgeInsetsMake(0, 10, 5, 10);
    return textNode;

字典中指定的其余属性执行正常。

谁能解释为什么?谢谢。

标签: iostexturesasyncdisplaykit

解决方案


事实证明,自定义属性在 ASTextNode2 中可用并由开关控制。


推荐阅读