AsyncDisplayKit

AsyncDisplayKit is an iOS framework that keeps even the most complex user interfaces smooth and responsive. It was originally built to make Facebook's Paper possible, and goes hand-in-hand with pop's physics-based animations — but it's just as powerful with UIKit Dynamics and conventional app designs.

AsyncDisplayKit(异步图形显示)是一个iOS的开源框架,它能改善非常复杂的用户交互卡顿的问题,并使其圆滑。最开始,开发它是用来优化Facebook的Paper应用,以及配合pop的物理引擎动画--当然,它像UIKit Dynamics框架一样高效且设计精美。

Quick start

ASDK is available on CocoaPods. Add the following to your Podfile:

ASDK可以通过CocoaPods安装,添加以下文件到Podfile中:

pod 'AsyncDisplayKit'

Import the framework header, or create an Objective-C bridging header if you're using Swift:

导入框架的头文件,或者创建Objective-C bridging header,如果你是使用Swift开发:

#import <AsyncDisplayKit/AsyncDisplayKit.h>

AsyncDisplayKit Nodes are a thread-safe abstraction layer over UIViews and CALayers:

AsyncDisplayKit的节点是一个线程安全的抽象layer,覆盖了UIView以及CALayer

You can construct entire node hierarchies in parallel, or instantiate and size a single node on a background thread — for example, you could do something like this in a UIViewController:

你可以通过封装的方式,或者是直接在子线程中实例化一个节点对象 -- 例如,你可以在UIViewController中做如下的操作:

dispatch_async(_backgroundQueue, ^{
ASTextNode *node = [[ASTextNode alloc] init];
node.attributedString = [[NSAttributedString alloc] initWithString:@"hello!"
attributes:nil];
[node measure:CGSizeMake(screenWidth, FLT_MAX)];
node.frame = (CGRect){ CGPointZero, node.calculatedSize }; // self.view isn't a node, so we can only use it on the main thread
dispatch_sync(dispatch_get_main_queue(), ^{
[self.view addSubview:node.view];
});
});

You can use ASImageNode and ASTextNode as drop-in replacements for UIImageView and UITextView, or create your own nodes to implement node hierarchies or custom drawing. ASTableView is a node-aware UITableView subclass that can asynchronously preload cell nodes without blocking the main thread.

你可以使用ASImageNode以及ASTextNode的继承类来替换UIImageView以及UITextView,或者创建你自己的节点,用以实现你自己的绘制方式,ASTableView就是一个自定义node的UITableView的子类,它可以异步装载cell节点而不阻塞主线程。

Learn more

[翻译] AsyncDisplayKit的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. python-cgi-demo

    简单的Python CGI 在linux平台实现注意:路径是以当前路径为根目录 ,Python文件一般放在/cgi-bin/目录下在linux命令行运行:python  -m  CGIHTTPServ ...

  2. WPF在XAML中使用MultiBinding的两个例子

    使用MultiBinding的原则:数据源有一个以上: 1. 需求:在一个需要显示的内容中,不同的部分要进行的处理不一样,这时可以使用MultiBinding <TextBlock> &l ...

  3. log4php0.9的详细配备实例说明

    一.什么是log4php: log4j在JAVA中可算是大名鼎鼎的日志开发包了,它为apche组织维护项目,VxR兄使用php来实现了log4j的功能, 目前log4php已经作为log4j的一个子项 ...

  4. assert函数的用法

    assert这个函数在php语言中是用来判断一个表达式是否成立.返回true or false; 例如: <?php $s = 123; assert("is_int($s)" ...

  5. js处理json数据,java处理json数据

    一.js处理json数据 处理办法之一是把本机json数据或远程返回json数据用eval函数,使之变成DOM对象. 例如: var people = { "programmers" ...

  6. 使用minikube在本机测试kubernetes

    目录 简介 安装 Docker CE 安装 kubectl 安装 minikube 启动 minikube 启动 dashboard 启动一个服务 删除服务 参考 本文主要讲解 minikube(ku ...

  7. 得到DataGrid列的值

    <mx:DataGridColumn headerText="状态" dataField="D30120_ZH" width="80" ...

  8. 使用 Python 编写脚本并发布

    使用 Python 编写脚本并发布 P1: 脚本 通常在 Linux 服务器上会遇到在命令行中输入命令的操作,而有些操作包含的命令数目较多或者其中的命令包含的参数较多,如果一个一个的敲命令的话就太麻烦 ...

  9. C++类数组的实现

    请看下面的代码: //xy_3_1 2013/10/26 #include<stdio.h> #include<iostream.h> #include<string.h ...

  10. C#中区别多态、重载、重写

    重写是指重写基类的方法,在基类中的方法必须有修饰符virtual,而在子类的方法中必须指明override. 格式: 基类中: public virtual void myMethod() { } 子 ...