ASDisplayNode(UIViewBridge) Category Reference
Declared in | ASDisplayNode.h |
---|
Overview
UIView bridge
ASDisplayNode provides thread-safe access to most of UIView and CALayer properties and methods, traditionally unsafe.
Using them will not cause the actual view/layer to be created, and will be applied when it is created (when the view or layer property is accessed).
- NOTE: After the view or layer is created, the properties pass through to the view or layer directly and must be called on the main thread.
See UIView and CALayer for documentation on these common properties.
– setNeedsDisplay
Marks the view as needing display. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread.
- (void)setNeedsDisplay
Declared In
ASDisplayNode.h
– setNeedsLayout
Marks the node as needing layout. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread.
- (void)setNeedsLayout
Discussion
If this node was measured, calling this method triggers an internal relayout: the calculated layout is invalidated, and the supernode is notified or (if this node is the root one) a full measurement pass is executed using the old constrained size.
Note: ASCellNode has special behavior in that calling this method will automatically notify the containing ASTableView / ASCollectionView that the cell should be resized, if necessary.
Declared In
ASDisplayNode.h
backgroundColor
The node view’s background color.
@property (nonatomic, strong, nullable) UIColor *backgroundColor
Discussion
In contrast to UIView, setting a transparent color will not set opaque = NO. This only affects nodes that implement +drawRect like ASTextNode.
Declared In
ASDisplayNode.h
contentMode
A flag used to determine how a node lays out its content when its bounds change.
@property (nonatomic, assign) UIViewContentMode contentMode
Discussion
This is like UIView’s contentMode property, but better. We do our own mapping to layer.contentsGravity in _ASDisplayView. You can set needsDisplayOnBoundsChange independently. Thus, UIViewContentModeRedraw is not allowed; use needsDisplayOnBoundsChange = YES instead, and pick an appropriate contentMode for your content while it’s being re-rendered.
Declared In
ASDisplayNode.h