13 Commits

Author SHA1 Message Date
rcancro
b4a6f87ca6 addressed some comments 2016-05-10 14:44:32 -07:00
rcancro
8bb4eba080 Initial attempt at implementing Display Traits
Initial attempt to get display traits working with ASEnvironment.

To get proper ASDisplayTraits support, you must use an ASViewController. The ASViewController implements UITraitCollection-related methods (`traitCollectionDidChange:`, `willTransitionToTraitCollection:withTransitionCoordinator:`, viewWillTransitionToSize:withTransitionCoordinator`) to update the internal ASDisplayTraits and propagate them to subnodes.

ASTableNode and ASCollectionNode don't actually have their cells as subnodes, so a little bit of trickery is involved (on `setEnvironment:` the table/collection node gets its data controllers completedNodes and propagates the new traits. see `ASDisplayTraitsCollectionTableSetEnvironmentState`). The data controller also passes the current display traits when creating new cells.

ASViewController also supports the ability to return a custom set of display traits. So if you have a modal dialog that should always be told it is in a compact size class, you can set the override block before displaying the VC.

A new example, called Display Traits, has been added. It shows how display traits can be used in a ASViewController with a normal ASDisplayNode as its root, as well as in ASViewControllers hosting table nodes and collection nodes. There is also an example of overriding the default display traits of a VC.

Please provide feedback!
2016-05-10 14:44:22 -07:00
Rahul Malik
a509b7523f Update interface of ASViewController to use lightweight generics. This allows
subclasses of ASViewController to specify the type of ASDisplayNode it
contains which allows for stronger type-checking and auto-completion against
the specified type.

Example Subclass Declaration:
@interface MyASViewController : ASViewController<MyASDisplayNodeSubclass *>
@end
2016-01-03 18:56:09 -08:00
Scott Goodson
882d4b336e Merge branch 'master' into pr/664 2015-12-25 14:32:41 -08:00
Scott Goodson
065625f246 Make ASCollectionView always create an ASCollectionNode. Add visibilityDidChange:, interfaceStateDidChange:fromState: 2015-12-22 21:46:46 -08:00
Adlai Holler
b4b88da8cd Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/ASCellNode.h
2015-11-02 09:36:46 -08:00
Levi McCallum
03bd1f4358 Expose ASViewController's constrained size for subclass customization 2015-10-27 11:40:43 -07:00
Adlai Holler
8bb9d173dc Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/ASDisplayNode+Subclasses.h
	AsyncDisplayKit/ASMultiplexImageNode.h
	AsyncDisplayKit/ASViewController.h
	AsyncDisplayKit/Details/ASDataController.h
2015-10-05 13:24:16 -07:00
Scott Goodson
a58844379c Implementation of Synchronous Concurrency features for AsyncDisplayKit 2.0
This provides internal features on _ASAsyncTransaction and ASDisplayNode to facilitate
implementing public API that allows clients to choose if they would prefer to block
on the completion of unfinished rendering, rather than allow a placeholder state to
become visible.

The internal features are:
-[_ASAsyncTransaction waitUntilComplete]
-[ASDisplayNode recursivelyEnsureDisplay]

Also provided are two such implementations:
-[ASCellNode setNeverShowPlaceholders:], which integrates with both Tables and Collections
-[ASViewController setNeverShowPlaceholders:], which should work with Nav and Tab controllers.

Lastly, on ASDisplayNode, a new property .shouldBypassEnsureDisplay allows individual node types
to exempt themselves from blocking the main thread on their display.

By implementing the feature at the ASCellNode level rather than ASTableView & ASCollectionView,
developers can retain fine-grained control on display characteristics.  For example, certain
cell types may be appropriate to display to the user with placeholders, whereas others may not.

Follow-up work will include unit tests, revisiting names, and the header locations of definitions.
2015-09-27 19:14:36 -07:00
Adlai Holler
717df1cfd2 Merge latest master and update Layout headers 2015-09-17 11:39:59 -07:00
Huy Nguyen
a864341710 Remove nonnull and nuulable annotations in ASViewController. Travis don't recognize them (yet). 2015-09-17 16:07:43 +03:00
Huy Nguyen
fcd76dbd19 Use nonnull annotation, instead of sanity check, for node property in ASViewController. 2015-09-17 15:59:37 +03:00
Huy Nguyen
07c0d78c71 Add ASViewController and update Multiplex sample to use it. 2015-09-17 15:58:21 +03:00