Texture icon indicating copy to clipboard operation
Texture copied to clipboard

ASTextNode(2) does not support custom view in attributed string.

Open iwecon opened this issue 4 years ago • 2 comments

ASTextNode and ASTextNode2 does not support custom view in attributed string.

YYLabel is fine, the view has displayed. CleanShot 2021-08-23 at 09 49 26@2x

ASTextNode is nothing for attachment. CleanShot 2021-08-23 at 09 52 53@2x

ASTextNode2, just displaying the frame of attachment. CleanShot 2021-08-23 at 09 50 59@2x

How do I fix that?

iwecon avatar Aug 23 '21 02:08 iwecon

I found a NSAttributedString+ASText.h.

It and YYText look the same.

I can probably confirm that it is because ASText's built-in AttachmentKey is 'ASTextAttachment', but YYText is 'YYTextAttachment', the two keys are different, resulting in the failure to match the results.

Can someone give me some advice? and Why do make it(NSAttributedString+ASText.h) private?

CleanShot 2021-08-23 at 10 49 06@2x CleanShot 2021-08-23 at 10 50 08@2x CleanShot 2021-08-23 at 10 51 39@2x

iwecon avatar Aug 23 '21 02:08 iwecon

Wait...

I continued to confirm, it has something to do with AttributeName, but more importantly, ASTextNode/2 is a NSObject.

So drawInContext:size:point:view:layer:debug:cancel can not add view to display.

CleanShot 2021-08-23 at 13 50 12@2x CleanShot 2021-08-23 at 13 51 01@2x

iwecon avatar Aug 23 '21 05:08 iwecon