Skip to content

[ASTextNode] truncationAttributedText / additionalTruncationMessage don't always fit. #142

Open
@garrettmoon

Description

@garrettmoon

From @Yue-Wang-Google on August 25, 2016 20:5

Test case:

Apply the following patch to the Kittens example:

--- /Users/wangyue/Downloads/AsyncDisplayKit-master/examples/Kittens/Sample/KittenNode.mm   2016-08-25 10:03:06.000000000 -0700
+++ Sample/KittenNode.mm    2016-08-25 13:00:22.000000000 -0700
@@ -98,8 +98,12 @@

   // lorem ipsum text, plus some nice styling
   _textNode = [[ASTextNode alloc] init];
+  _textNode.truncationMode = NSLineBreakByTruncatingTail;
+  _textNode.maximumNumberOfLines = 2;
   _textNode.attributedString = [[NSAttributedString alloc] initWithString:[self kittyIpsum]
                                                                attributes:[self textStyle]];
+  _textNode.truncationAttributedText = [[NSAttributedString alloc] initWithString:@"\u2026 More"
+                                                                       attributes:[self textStyle]];
   [self addSubnode:_textNode];

   // hairline cell separator

See the first node in the following screenshot.

screen shot 2016-08-25 at 1 04 44 pm

Copied from original issue: facebookarchive/AsyncDisplayKit#2140

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions