[英]Texture ASTextNode border and shadow attributes do not work
這是我的代碼,我在超級視圖上放置了一個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;
字典中指定的其余屬性正常執行。
誰能解釋為什么? 謝謝。
事實證明,自定義屬性在ASTextNode2中可用,並由switch控制。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.