ASCellNode Class Reference
| Inherits from | ASDisplayNode : ASDealloc2MainObject |
|---|---|
| Declared in | ASCellNode.h |
Overview
Generic cell node. Subclass this instead of
ASDisplayNodeto use withASTableViewandASCollectionView.@note When a cell node is contained inside a collection view (or table view),
- calling
-setNeedsLayoutwill also notify the collection on the main thread - so that the collection can update its item layout if the cell’s size changed.
neverShowPlaceholders
When enabled, ensures that the cell is completely displayed before allowed onscreen.
@default NO
@property (nonatomic, assign) BOOL neverShowPlaceholdersDiscussion
Normally, ASCellNodes are preloaded and have finished display before they are onscreen. However, if the Table or Collection’s rangeTuningParameters are set to small values (or 0), or if the user is scrolling rapidly on a slow device, it is possible for a cell’s display to be incomplete when it becomes visible.
In this case, normally placeholder states are shown and scrolling continues uninterrupted. The finished, drawn content is then shown as soon as it is ready.
With this property set to YES, the main thread will be blocked until display is complete for the cell. This is more similar to UIKit, and in fact makes AsyncDisplayKit scrolling visually indistinguishable from UIKit’s, except being faster.
Using this option does not eliminate all of the performance advantages of AsyncDisplayKit. Normally, a cell has been preloading and is almost done when it reaches the screen, so the blocking time is very short. If the rangeTuningParameters are set to 0, still this option outperforms UIKit: while the main thread is waiting, subnode display executes concurrently.
Declared In
ASCellNode.h
selected
A Boolean value that is synchronized with the underlying collection or tableView cell property. Setting this value is equivalent to calling selectItem / deselectItem on the collection or table.
@property (nonatomic, assign, getter=isSelected) BOOL selectedDeclared In
ASCellNode.h
highlighted
A Boolean value that is synchronized with the underlying collection or tableView cell property. Setting this value is equivalent to calling highlightItem / unHighlightItem on the collection or table.
@property (nonatomic, assign, getter=isHighlighted) BOOL highlightedDeclared In
ASCellNode.h
– applyLayoutAttributes:
Called by the system when ASCellNode is used with an ASCollectionNode. It will not be called by ASTableNode. When the UICollectionViewLayout object returns a new UICollectionViewLayoutAttributes object, the corresponding ASCellNode will be updated. See UICollectionViewCell’s applyLayoutAttributes: for a full description.
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributesDeclared In
ASCellNode.h
– initWithViewControllerBlock:didLoadBlock:
Initializes a cell with a given view controller block.
- (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlockParameters
viewControllerBlock |
The block that will be used to create the backing view controller. |
|---|---|
didLoadBlock |
The block that will be called after the view controller’s view is loaded. |
Return Value
An ASCellNode created using the root view of the view controller provided by the viewControllerBlock. The view controller’s root view is resized to match the calculated size produced during layout.
Declared In
ASCellNode.h