facebookarchive / AsyncDisplayKit

Smooth asynchronous user interfaces for iOS apps.
http://asyncdisplaykit.org
Other
13.4k stars 2.2k forks source link

Some problems with ASTableNode #3294

Open ghost opened 7 years ago

ghost commented 7 years ago

I implement the ASTableNode with cell contains html. I'm using a third-party UIView wrapped in a ASDisplayNode to display HTML(sometimes html is big and contains a lot of image). So sometime it requires a long calculation/drawing. This is awesome but I can see some problems with the library. I'm really appreciate if you can help me identified some problems?

  1. During debug I see the table calculate the first cell size lastly. So is there any way to calculate first cell size firstly? Because next cells could be big and long drawing, and it takes a long time to display the table.

This is the debug text, showed cell 4 will calculated and layout first

"Cell [0, 4] - ratio 0.131707317073171" "Cell [0, 4] - ratio 0.131707317073171" "Cell [0, 3] - ratio 0.131707317073171" "Cell [0, 3] - ratio 0.131707317073171" "Cell [0, 2] - ratio 0.214634146341463" "Cell [0, 2] - ratio 0.214634146341463" "Cell [0, 1] - ratio 0.131707317073171" "Cell [0, 1] - ratio 0.131707317073171" "Cell [0, 0] - ratio 3.28780487804878" "Cell [0, 0] - ratio 3.28780487804878" "Cell [0, 0] - ratio 3.28780487804878" "Cell [0, 0] - ratio 3.28780487804878"

  1. One more problem I could see the table cell did not display the wrapped UIView correctly. Some cells with short text will show the vertical lines. After scroll up and down, the cell is normal again.

Screenshot

3 . And when the wrapped UIView in ASDisplayNode changes the size, the wrapper ASDisplayNode does know about this and does not change at all. Is there any way for the wrapper node know it's UIView size change?

My wrapper UIView code:

textContentNode = ASDisplayNode { [unowned self] () -> UIView in let textView = MyCustomHtmlView() textView.attributedString = attrHtml textView.delegate = self textView.edgeInsets = self.insets return textView }

During the delegate for update images (I was using ASNetworkImage), if the image downloaded completely, I update the textView and no way the textContentNode changes the size (I called setNeedLayout ...)

ay8s commented 7 years ago

Please update to use Texture and ask any questions over in the Texture repository. https://github.com/texturegroup/texture