16 Commits

Author SHA1 Message Date
Huy Nguyen
2149d44990 Fix naming convetion:
- "Layout node" is changed to "layout spec".
- Update tests.
- Update Kittens sample.
2015-07-01 18:13:44 +07:00
Huy Nguyen
95e787b226 Remove stack children type:
- ASLayoutable requires mutable properties that are used when attached to a stack layout.
- Thus, ASLayoutable objects (including ASDisplayNode) can be injected into stack layout directly.
- ASStackLayoutNodeChild no longer needed.
- Tests and Kitten sample updated.
2015-06-26 11:47:42 +07:00
Huy Nguyen
f588bceb4d Introduce ASLayoutable and eliminate ASCompositeNode:
- Both ASDisplayNode and ASLayoutNode conforms to this protocol.
- ASDisplayNode can be embeded directly into layout graph.
- Eliminate ASCompositeNode.
- Fix ASStaticSizeDisplayNode not recpect min constrained size.
- Updated tests.
2015-06-26 09:29:16 +07:00
Huy Nguyen
64e2323a4e Remove ASLayoutNodeSize:
- ASLayoutNode no longer has 'size' constraint during its initialization..
- ASLayoutNode no longer needs parentSize to calculate its layout.
2015-06-25 11:34:36 +07:00
Huy Nguyen
abe98d5b09 Integrate new layout nodes to the framework.
- Introduce ASLayoutNode and its subclasses.
- ASDisplayNode measures its ASLayoutNode and cache the result (ASLayout). Calculated size and position of each subnode can be retrieved from the calculated layout.
- Custom nodes need to override -layoutNodeThatFits:(CGSize) instead of -calculateSizeThatFits:(CGSize).
- Custom nodes do not need to layout its subnodes (in -layout:) anymore. ASDisplayNode can handle the job most of the time, by walking through its layout tree.
- ASCompositeNode is used to embed (display) subnodes to a node's layout. That way, each subnode will also be measured while the parent node is measuring. And the parent node knows where its subnodes are within its layout.
2015-06-25 11:34:35 +07:00
Nadine Salter
d9e7e5d931 Merge pull request #250 from facebook/ASScrollNode
Simple UIScrollView wrapper node.
2015-02-02 11:03:21 -08:00
Nadine Salter
ad57e126e7 Simple UIScrollView wrapper node.
Closes #99.  This is a quick sketch -- room for improvement includes
considering a less-questionable class name, potentially exposing
additional UIScrollView functionality directly on the node, and using it
in a sample project.
2015-01-24 12:11:59 -08:00
Nadine Salter
9cf71828ad Include ASEditableTextNode in framework header. 2015-01-24 12:04:06 -08:00
Nadine Salter
3c690bf9e5 ASBasicImageDownloader.
This is a simplistic, NSURLSession-based downloader object that
implements ASImageDownloaderProtocol and can be used with
ASMultiplexImageNode and ASNetworkImageNode.

(Closes #115.  NSURLSession should suffice for most usecases, and this
code should provide a good jumping-off point for a more-complex
implementation.)
2014-11-21 18:40:18 -08:00
Nadine Salter
460b3582c9 Update umbrella header. 2014-11-18 18:21:41 -08:00
appleguy
3f7dc75bb1 Merge pull request #101 from nguyenhuy/collection_view
Add ASCollectionView
2014-11-17 19:03:59 -08:00
Nadine Salter
3c8d4e9517 ASMultiplexImageNode.
Initial open-source release of ASMultiplexImageNode.  Documentation and
example code forthcoming.

Note:  ASMultiplexImageNode requires Xcode 6 to compile.  Tests are now
compiled against the iOS 8 SDK and run on iOS 7.1 and iOS 8.
2014-11-17 15:02:17 -08:00
Huy Nguyen
1df67c42b9 Implement ASCollectionView. Horizontal scrolling is not supported yet. 2014-11-12 21:25:56 +02:00
Nadine Salter
7dd94a6102 Merge in downstream changes.
Introduce `ASTableView`, a UITableView subclass that uses `ASCellNode`
instead of UITableViewCell.  Add working range support via
`ASRangeController`, which observes the visible range, maintains a
working range, and handles most ASDK machinery.  ASRangeController is
loosely-enough coupled that it should be easily adapted to
UICollectionView if that's desired in the future.

Notable considerations in the ASRangeController architecture:

* There's no sense rewriting UITableView -- the real win comes from
  using nodes instead of UITableViewCells (easily parallelisable
  computation, large number of cells vs. few table views, etc.).  So,
  use a UITableView with empty cells, using UITableViewCell's
  contentView as a host for arbitrary node hierarchies.

* Instead of lazy-loading cells the instant they're needed by
  UITableView, load them in advance.  Preload a substantial number of
  nodes in the direction of scroll, as well as a small buffer in the
  other direction.

* Maintain compatibility with UITableView's API, with one primary change
  -- consumer code yields configured ASCellNodes, not UITableViewCells.

* Don't use -tableView:heightForRowAtIndexPath:.  Nodes already compute
  their preferred sizes and cache results for use at layout-time, so
  ASTableView uses their calculatedSizes directly.

* Corollary:  ASTableView is only aware of nodes that have been sized.
  This means that, if a cell appears onscreen, it has layout data and
  can display a "realistic placeholder", e.g. by making its subnodes'
  background colour grey.

Other improvements:

* Remove dead references and update headers (fixes #7, #20).

* Rename `-[ASDisplayNode sizeToFit:]` to `-measure:` and fix
  `constrainedSizeForCalulatedSize` typo (fixes #15).

* Rename `-willAppear` and `-didDisappear` to `-willEnterHierarchy` and
  `-didExitHierarchy`.  Remove `-willDisappear` -- it was redundant, and
  there was no counterpart `-didAppear`.

* Rename `viewLoaded` to `nodeLoaded`.
2014-09-22 14:33:39 -07:00
Arnaud Coomans
8b8a8fdb0d Files organization 2014-08-05 16:48:46 -07:00
Andrew Toulouse
1efe3d95d6 Add umbrella header
Summary:
Import the headers for control, image, and text nodes, as well as the normal display node and helper functions. Subclass headers omitted as they are intended to be imported in subclass implementation files, not public headers.

Test Plan:
`#import <AsyncDisplayKit/AsyncDisplayKit.h>` followed some time later by:
```
ASDisplayNode *node;
ASImageNode *node2;
ASTextNode *node3;
ASControlNode *node4;
```
2014-07-18 00:30:32 -07:00