Files
Swiftgram/submodules/AsyncDisplayKit/docs/_docs/inversion.md
Peter 9bc996374f Add 'submodules/AsyncDisplayKit/' from commit '02bedc12816e251ad71777f9d2578329b6d2bef6'
git-subtree-dir: submodules/AsyncDisplayKit
git-subtree-mainline: d06f423e0e
git-subtree-split: 02bedc1281
2019-06-11 18:42:43 +01:00

1.6 KiB
Executable File

title, layout, permalink, prevPage, nextPage
title layout permalink prevPage nextPage
Inversion docs /docs/inversion.html automatic-subnode-mgmt.html image-modification-block.html

ASTableNode and ASCollectionNode have a inverted property of type BOOL that when set to YES, will automatically invert the content so that it's layed out bottom to top, that is the 'first' (indexPath 0, 0) node is at the bottom rather than the top as usual. This is extremely covenient for chat/messaging apps, and with Texture it only takes one property.

When this is enabled, developers only have to take one more step to have full inversion support and that is to adjust the contentInset of their ASTableNode or ASCollectionNode like so:

Swift Objective-C
 CGFloat inset = [self topBarsHeight];
 self.tableNode.view.contentInset = UIEdgeInsetsMake(0, 0, inset, 0);
 self.tableNode.view.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, inset, 0);
  
  let inset = self.topBarsHeight
  self.tableNode.view.contentInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: inset, right: 0.0)
  self.tableNode.view.scrollIndicatorInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: inset, right: 0.0)
  

See the SocialAppLayout-Inverted example project for more details.