Asyncdisplaykit Official document reading 1

why our app is lag?

iOS device screen fps(frame per seconds) is 60hz,it means app must keep fps no less than 60 to avoid app leg,if the fps under 60,we will see the image is not continued and become not smooth,some people may ask a problem how can we get the system response callback.the system provide a method called CADisplayLink,and execute it every 16 milliseconds,we can use it in executing all layout and drawing code.

tips:

if our app is busy in other things,system may skip calling the method.maybe it is the reason why we should not put some things in main thread.

http://asyncdisplaykit.org/docs/getting-started.html

asyncdiplaykit replace the majority of uikit with node,Of course, you can always access the underlying view or layer directly via node.view or node.layer, just make sure to do it on the main thread!

Core Concepts

it main includes several facts as follow:

1.Intelligent Preloading

its main work principle.why asyncdisplaykit can give user interface interactive so good.

Asyncdisplaykit Official document reading 1_第1张图片

It has three interface state.preload,display and visible, we can see them in above picture. As a user scrolls, nodes move through the ranges and react appropriately by loading data, rendering, etc. Your own node subclassescan easily tap into this mechanism by implementing the corresponding callback methods.

Visible Range

-didEnterVisibleState

-didExitVisibleState

Display Range

-didEnterDisplayState

-didExitDisplayState

Preload Range

-didEnterPreloadState

-didExitPreloadState

Node Containers

Every node has its node containers.The advantage of node containers is it can provide many methods for us,help us save time.

What do I Gain by Using a Node Container?

A node container automatically manages the intelligent preloading of its nodes. This means that all of the node’s layout measurement, data fetching, decoding and rendering will be done asynchronously. Among other conveniences, this is why it is recommended to use nodes within a container node.

Note that while it is possible to use nodes directly (without an AsyncDisplayKit node container), unless you add additional calls, they will only start displaying once they come onscreen (as UIKit does). This can lead to performance degredation and flashing of content.

Node Subclasses

asyncdisplaykit.org/static/images/node-hierarchy.png

Nodes can offer more advanced features and conveniences.For example, an ASNetworkImageNode does automatic loading and cache management, and even supports progressive jpeg and animated gifs.

http://asyncdisplaykit.org/docs/faq.html

This website offer some tips and solutions we need attention.

你可能感兴趣的:(Asyncdisplaykit Official document reading 1)