ASCellNode Class Reference
|ASDisplayNode : ASDealloc2MainObject
Generic cell node. Subclass this instead of
ASDisplayNodeto use with
@note When a cell node is contained inside a collection view (or table view),
-setNeedsLayoutwill also notify the collection on the main thread
- so that the collection can update its item layout if the cell’s size changed.
When enabled, ensures that the cell is completely displayed before allowed onscreen.
@property (nonatomic, assign) BOOL neverShowPlaceholders
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.
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 selected
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 highlighted
The current index path of this cell node, or @c nil if this node is not a valid item inside a table node or collection node.
@property (nonatomic, readonly, nullable) NSIndexPath *indexPath
Note: This property must be accessed on the main thread.
The owning node (ASCollectionNode/ASTableNode) of this cell node, or @c nil if this node is not a valid item inside a table node or collection node or if those nodes are nil.
@property (weak, nonatomic, readonly, nullable) ASDisplayNode *owningNode
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 *)layoutAttributes
Initializes a cell with a given view controller block.
- (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock
The block that will be used to create the backing view controller.
The block that will be called after the view controller’s view is loaded.
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.
Notifies the cell node of certain visibility events, such as changing visible rect.
- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(nullable UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame
Warning: In cases where an ASCellNode is used as a plain node – i.e. not returned from the
nodeBlockForItemAtIndexPath/nodeForItemAtIndexPath data source methods – this method will
deliver only the
scrollView will be nil, and
cellFrame will be the zero rect.