Node 子類
Texture 提供了下面這些 nodes.
相比于 UIKit 元件, 使用 nodes 的一個關鍵的優勢是: 所有 nodes 脫離主線程執行布局和顯示, 這就使得主線程可以立即響應使用者的互動事件.
Texture Node | UIKit Equivalent |
---|---|
ASDisplayNode | 代替 UIKit 中的 UIView, Texture 中的根 node, 所有其它 node 繼承與它 |
ASCellNode | 代替 UIKit 中的 UITableViewCell 和 UICollectionViewCell ASCellNodes 用于 ASTableNode, ASCollectionNode 和 ASPagerNode |
ASScrollNode | 代替 UIKit 中的 UIScrollView, 對于建立一個自定義的可滑動的, 包含其它 nodes 的區域, 這個 node 是非常有用的 |
ASEditableTextNode | 代替 UIKit 中的 UITextView |
ASTextNode | 代替 UIKit 中的 UILabel |
ASImageNode, ASNetworkImageNode, ASMultiplexImageNode | 代替 UIKit 中的 UIImage |
ASVideoNode | 代替 UIKit 中的 AVPlayerLayer |
ASVideoPlayerNode | 代替 UIKit 中的 UIMoviePlayer |
ASControlNode | 代替 UIKit 中的 UIControl |
ASButtonNode | 代替 UIKit 中的 UIButton |
ASMapNode | 代替 UIKit 中的 MKMapView |
盡管與UIKit元件具有粗略的等效性,但通常,Texture節點提供更進階的功能和便利性。 例如,
ASNetworkImageNode
執行自動加載和緩存管理,甚至支援漸進式jpeg和GIF動畫。
AsyncDisplayKitOverview
示例應用程式提供了上面列出的每個節點的基本實作。
Node Inheritance Hierarchy
所有的 Texture 節點繼承與
ASDisplayNode
.
以藍色突出顯示的節點是UIKit元素的同步包裝器。 例如,
ASScrollNode
包裝
UIScrollView
,
ASCollectionNode
包裝
UICollectionView
。
liveMapMode
中的
ASMapNode
是
UIMapView
的同步包裝器。