Merge branch 'master' into FBSnapshotTestCase-version

This commit is contained in:
Ethan Nagel
2015-07-13 14:36:51 -07:00
37 changed files with 426 additions and 97 deletions

View File

@@ -187,13 +187,13 @@
509E68661B3AEDD7009B9150 /* CGRect+ASConvenience.m in Sources */ = {isa = PBXBuildFile; fileRef = 205F0E201B376416007741D0 /* CGRect+ASConvenience.m */; };
6BDC61F61979037800E50D21 /* AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
9F06E5CD1B4CAF4200F015D8 /* ASCollectionViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F06E5CC1B4CAF4200F015D8 /* ASCollectionViewTests.m */; };
AC21EC101B3D0BF600C8B19A /* ASStackLayoutChild.h in Headers */ = {isa = PBXBuildFile; fileRef = AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutChild.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC21EC101B3D0BF600C8B19A /* ASStackLayoutDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutDefines.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC3C4A511A1139C100143C57 /* ASCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC3C4A521A1139C100143C57 /* ASCollectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A501A1139C100143C57 /* ASCollectionView.mm */; };
AC3C4A541A113EEC00143C57 /* ASCollectionViewProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A531A113EEC00143C57 /* ASCollectionViewProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC47D9421B3B891B00AAEE9D /* ASCellNode.m in Sources */ = {isa = PBXBuildFile; fileRef = AC6456071B0A335000CF11B8 /* ASCellNode.m */; };
AC47D9451B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h in Headers */ = {isa = PBXBuildFile; fileRef = AC47D9431B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC47D9461B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC47D9441B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm */; };
AC47D9451B3BB41900AAEE9D /* ASRelativeSize.h in Headers */ = {isa = PBXBuildFile; fileRef = AC47D9431B3BB41900AAEE9D /* ASRelativeSize.h */; settings = {ATTRIBUTES = (Public, ); }; };
AC47D9461B3BB41900AAEE9D /* ASRelativeSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */; };
AC6456091B0A335000CF11B8 /* ASCellNode.m in Sources */ = {isa = PBXBuildFile; fileRef = AC6456071B0A335000CF11B8 /* ASCellNode.m */; };
ACF6ED1A1B17843500DA7C62 /* ASBackgroundLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; };
ACF6ED1B1B17843500DA7C62 /* ASBackgroundLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutSpec.mm */; };
@@ -526,12 +526,12 @@
4640521F1A3F83C40061C0BA /* ASMultidimensionalArrayUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASMultidimensionalArrayUtils.mm; sourceTree = "<group>"; };
6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AsyncDisplayKit.h; sourceTree = "<group>"; };
9F06E5CC1B4CAF4200F015D8 /* ASCollectionViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCollectionViewTests.m; sourceTree = "<group>"; };
AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutChild.h; path = AsyncDisplayKit/Layout/ASStackLayoutChild.h; sourceTree = "<group>"; };
AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutDefines.h; path = AsyncDisplayKit/Layout/ASStackLayoutDefines.h; sourceTree = "<group>"; };
AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionView.h; sourceTree = "<group>"; };
AC3C4A501A1139C100143C57 /* ASCollectionView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASCollectionView.mm; sourceTree = "<group>"; };
AC3C4A531A113EEC00143C57 /* ASCollectionViewProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionViewProtocols.h; sourceTree = "<group>"; };
AC47D9431B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASStaticLayoutSpecDimension.h; path = AsyncDisplayKit/Layout/ASStaticLayoutSpecDimension.h; sourceTree = "<group>"; };
AC47D9441B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASStaticLayoutSpecDimension.mm; path = AsyncDisplayKit/Layout/ASStaticLayoutSpecDimension.mm; sourceTree = "<group>"; };
AC47D9431B3BB41900AAEE9D /* ASRelativeSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASRelativeSize.h; path = AsyncDisplayKit/Layout/ASRelativeSize.h; sourceTree = "<group>"; };
AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASRelativeSize.mm; path = AsyncDisplayKit/Layout/ASRelativeSize.mm; sourceTree = "<group>"; };
AC6456071B0A335000CF11B8 /* ASCellNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCellNode.m; sourceTree = "<group>"; };
ACF6ED011B17843500DA7C62 /* ASBackgroundLayoutSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASBackgroundLayoutSpec.h; path = AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h; sourceTree = "<group>"; };
ACF6ED021B17843500DA7C62 /* ASBackgroundLayoutSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = ASBackgroundLayoutSpec.mm; path = AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.mm; sourceTree = "<group>"; };
@@ -914,6 +914,8 @@
ACF6ED041B17843500DA7C62 /* ASCenterLayoutSpec.mm */,
ACF6ED071B17843500DA7C62 /* ASDimension.h */,
ACF6ED081B17843500DA7C62 /* ASDimension.mm */,
AC47D9431B3BB41900AAEE9D /* ASRelativeSize.h */,
AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */,
ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */,
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */,
ACF6ED0B1B17843500DA7C62 /* ASLayout.h */,
@@ -925,13 +927,11 @@
ACF6ED131B17843500DA7C62 /* ASOverlayLayoutSpec.mm */,
ACF6ED141B17843500DA7C62 /* ASRatioLayoutSpec.h */,
ACF6ED151B17843500DA7C62 /* ASRatioLayoutSpec.mm */,
AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutChild.h */,
AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutDefines.h */,
ACF6ED161B17843500DA7C62 /* ASStackLayoutSpec.h */,
ACF6ED171B17843500DA7C62 /* ASStackLayoutSpec.mm */,
ACF6ED181B17843500DA7C62 /* ASStaticLayoutSpec.h */,
ACF6ED191B17843500DA7C62 /* ASStaticLayoutSpec.mm */,
AC47D9431B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h */,
AC47D9441B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm */,
);
name = Layout;
path = ..;
@@ -971,8 +971,8 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
AC21EC101B3D0BF600C8B19A /* ASStackLayoutChild.h in Headers */,
AC47D9451B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.h in Headers */,
AC21EC101B3D0BF600C8B19A /* ASStackLayoutDefines.h in Headers */,
AC47D9451B3BB41900AAEE9D /* ASRelativeSize.h in Headers */,
ACF6ED511B17847A00DA7C62 /* ASStackUnpositionedLayout.h in Headers */,
ACF6ED2D1B17843500DA7C62 /* ASRatioLayoutSpec.h in Headers */,
ACF6ED261B17843500DA7C62 /* ASLayoutSpec.h in Headers */,
@@ -1374,7 +1374,7 @@
ACF6ED1B1B17843500DA7C62 /* ASBackgroundLayoutSpec.mm in Sources */,
055F1A3519ABD3E3004DAFF1 /* ASTableView.mm in Sources */,
205F0E121B371BD7007741D0 /* ASScrollDirection.m in Sources */,
AC47D9461B3BB41900AAEE9D /* ASStaticLayoutSpecDimension.mm in Sources */,
AC47D9461B3BB41900AAEE9D /* ASRelativeSize.mm in Sources */,
ACF6ED271B17843500DA7C62 /* ASLayoutSpec.mm in Sources */,
ACF6ED211B17843500DA7C62 /* ASDimension.mm in Sources */,
464052261A3F83C40061C0BA /* ASMultidimensionalArrayUtils.mm in Sources */,

View File

@@ -106,7 +106,7 @@ static const CGFloat kFontSize = 18.0f;
return self;
}
- (id<ASLayoutable>)layoutSpecThatFits:(ASSizeRange)constrainedSize
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
static const CGFloat kHorizontalPadding = 15.0f;
static const CGFloat kVerticalPadding = 11.0f;

View File

@@ -31,11 +31,11 @@
@property (nonatomic, weak) id<ASCollectionViewDelegate> asyncDelegate; // must not be nil
/**
* Tuning parameters for a range.
* Tuning parameters for a range type.
*
* @param range The range to get the tuning parameters for.
* @param rangeType The range type to get the tuning parameters for.
*
* @returns A tuning parameter value for the given range.
* @returns A tuning parameter value for the given range type.
*
* Defaults to the render range having one sceenful both leading and trailing and the preload range having two
* screenfuls in both directions.
@@ -43,16 +43,24 @@
- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType;
/**
* Set the tuning parameters for a range.
* Set the tuning parameters for a range type.
*
* @param tuningParameters The tuning parameters to store for a range.
* @param range The range to set the tuning parameters for.
* @param tuningParameters The tuning parameters to store for a range type.
* @param rangeType The range type to set the tuning parameters for.
*/
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType;
/**
* Initializer.
*
* @param frame The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview
* in which you plan to add it. This frame is passed to the superclass during initialization.
*
* @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object.
* Must not be nil.
*
* @param asyncDataFetchingEnabled Enable the data fetching in async mode.
*
* @discussion If asyncDataFetching is enabled, the `AScollectionView` will fetch data through `collectionView:numberOfRowsInSection:` and
* `collectionView:nodeForRowAtIndexPath:` in async mode from background thread. Otherwise, the methods will be invoked synchronically
* from calling thread.
@@ -87,25 +95,95 @@
- (void)reloadData;
/**
* Section updating.
* Inserts one or more sections.
*
* All operations are asynchronous and thread safe. You can call it from background thread (it is recommendated) and the UI collection
* view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes before these methods are called.
* @param sections An index set that specifies the sections to insert.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)insertSections:(NSIndexSet *)sections;
/**
* Deletes one or more sections.
*
* @param sections An index set that specifies the sections to delete.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)deleteSections:(NSIndexSet *)sections;
/**
* Reloads the specified sections.
*
* @param sections An index set that specifies the sections to reload.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)reloadSections:(NSIndexSet *)sections;
/**
* Moves a section to a new location.
*
* @param section The index of the section to move.
*
* @param newSection The index that is the destination of the move for the section.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection;
/**
* Items updating.
* Inserts items at the locations identified by an array of index paths.
*
* All operations are asynchronous and thread safe. You can call it from background thread (it is recommendated) and the UI collection
* view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes before these methods are called.
* @param indexPaths An array of NSIndexPath objects, each representing an item index and section index that together identify an item.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths;
/**
* Deletes the items specified by an array of index paths.
*
* @param indexPaths An array of NSIndexPath objects identifying the items to delete.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths;
/**
* Reloads the specified items.
*
* @param indexPaths An array of NSIndexPath objects identifying the items to reload.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths;
/**
* Moves the item at a specified location to a destination location.
*
* @param indexPath The index path identifying the item to move.
*
* @param newIndexPath The index path that is the destination of the move for the item.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI collection view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath;
/**
@@ -156,7 +234,7 @@
/**
* Similar to -collectionView:cellForItemAtIndexPath:.
*
* @param collection The sender.
* @param collectionView The sender.
*
* @param indexPath The index path of the requested node.
*

View File

@@ -15,14 +15,21 @@
*/
typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent)
{
/** A touch-down event in the control node. */
ASControlNodeEventTouchDown = 1 << 0,
/** A repeated touch-down event in the control node; for this event the value of the UITouch tapCount method is greater than one. */
ASControlNodeEventTouchDownRepeat = 1 << 1,
/** An event where a finger is dragged inside the bounds of the control node. */
ASControlNodeEventTouchDragInside = 1 << 2,
/** An event where a finger is dragged just outside the bounds of the control. */
ASControlNodeEventTouchDragOutside = 1 << 3,
/** A touch-up event in the control node where the finger is inside the bounds of the node. */
ASControlNodeEventTouchUpInside = 1 << 4,
/** A touch-up event in the control node where the finger is outside the bounds of the node. */
ASControlNodeEventTouchUpOutside = 1 << 5,
/** A system event canceling the current touches for the control node. */
ASControlNodeEventTouchCancel = 1 << 6,
/** All events, including system events. */
ASControlNodeEventAllEvents = 0xFFFFFFFF
};

View File

@@ -13,8 +13,7 @@
#import <AsyncDisplayKit/ASDisplayNode.h>
#import <AsyncDisplayKit/ASThread.h>
#import <AsyncDisplayKit/ASLayout.h>
#import <AsyncDisplayKit/ASLayoutable.h>
@class ASLayoutSpec;
/**
* The subclass header _ASDisplayNode+Subclasses_ defines the following methods that either must or can be overriden by
@@ -36,7 +35,7 @@
* variables.
*/
@interface ASDisplayNode (Subclassing) <ASLayoutable>
@interface ASDisplayNode (Subclassing)
/** @name View Configuration */
@@ -120,23 +119,6 @@
/** @name Layout calculation */
/**
* @abstract Asks the node to measure a layout based on given size range.
*
* @param constrainedSize The minimum and maximum sizes the receiver should fit in.
*
* @return An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used).
*
* @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the
* constraint and the result.
*
* @warning Subclasses must not override this; it caches results from -calculateLayoutThatFits:. Calling this method may
* be expensive if result is not cached.
*
* @see [ASDisplayNode(Subclassing) calculateLayoutThatFits:]
*/
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize;
/**
* @abstract Calculate a layout based on given size range.
*
@@ -180,7 +162,7 @@
*
* @note This method should not be called directly outside of ASDisplayNode; use -measure: or -calculatedLayout instead.
*/
- (id<ASLayoutable>)layoutSpecThatFits:(ASSizeRange)constrainedSize;
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize;
/**
* @abstract Invalidate previously measured and cached layout.
@@ -267,6 +249,8 @@
* @abstract Indicates that the receiver is about to display its subnodes. This method is not called if there are no
* subnodes present.
*
* @param subnode The subnode of which display is about to begin.
*
* @discussion Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) is
* about to begin.
*/
@@ -276,6 +260,8 @@
* @abstract Indicates that the receiver is finished displaying its subnodes. This method is not called if there are
* no subnodes present.
*
* @param subnode The subnode of which display is about to completed.
*
* @discussion Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) has
* completed.
*/

View File

@@ -13,7 +13,15 @@
#import <AsyncDisplayKit/ASDealloc2MainObject.h>
#import <AsyncDisplayKit/ASDimension.h>
#import <AsyncDisplayKit/ASLayoutable.h>
/**
* UIView creation block. Used to create the backing view of a new display node.
*/
typedef UIView *(^ASDisplayNodeViewBlock)();
/**
* CALayer creation block. Used to create the backing layer of a new display node.
*/
typedef CALayer *(^ASDisplayNodeLayerBlock)();
/**
@@ -32,7 +40,7 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
*
*/
@interface ASDisplayNode : ASDealloc2MainObject
@interface ASDisplayNode : ASDealloc2MainObject <ASLayoutable>
/** @name Initializing a node object */
@@ -50,6 +58,8 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
/**
* @abstract Alternative initializer with a block to create the backing view.
*
* @param viewBlock The block that will be used to create the backing view.
*
* @return An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main
* queue. The view will render synchronously and -layout and touch handling methods on the node will not be called.
*/
@@ -58,6 +68,8 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
/**
* @abstract Alternative initializer with a block to create the backing layer.
*
* @param viewBlock The block that will be used to create the backing layer.
*
* @return An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main
* queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called.
*/
@@ -132,11 +144,28 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
* -measureWithSizeRange: caches results from -calculateLayoutThatFits:. Calling this method may
* be expensive if result is not cached.
*
* @see [ASDisplayNode(Subclassing) measureWithSizeRange:]
* @see measureWithSizeRange:
* @see [ASDisplayNode(Subclassing) calculateLayoutThatFits:]
*/
- (CGSize)measure:(CGSize)constrainedSize;
/**
* @abstract Asks the node to measure a layout based on given size range.
*
* @param constrainedSize The minimum and maximum sizes the receiver should fit in.
*
* @return An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used).
*
* @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the
* constraint and the result.
*
* @warning Subclasses must not override this; it caches results from -calculateLayoutThatFits:. Calling this method may
* be expensive if result is not cached.
*
* @see [ASDisplayNode(Subclassing) calculateLayoutThatFits:]
*/
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize;
/**
* @abstract Return the calculated size.
*
@@ -332,7 +361,7 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
* This method is used to notify the node that it should purge any content that is both expensive to fetch and to
* retain in memory.
*
* @see clearFetchedData and fetchData
* @see [ASDisplayNode(Subclassing) clearFetchedData] and [ASDisplayNode(Subclassing) fetchData]
*/
- (void)recursivelyClearFetchedData;
@@ -341,7 +370,7 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
*
* @discussion Fetches content from remote sources for the current node and all subnodes.
*
* @see fetchData and clearFetchedData
* @see [ASDisplayNode(Subclassing) fetchData] and [ASDisplayNode(Subclassing) clearFetchedData]
*/
- (void)recursivelyFetchData;
@@ -556,18 +585,22 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
@interface ASDisplayNode (ASDisplayNodeAsyncTransactionContainer) <ASDisplayNodeAsyncTransactionContainer>
@end
/** UIVIew(AsyncDisplayKit) defines convenience method for adding sub-ASDisplayNode to an UIView. */
@interface UIView (AsyncDisplayKit)
/**
* Convenience method, equivalent to [view addSubview:node.view] or [view.layer addSublayer:node.layer] if layer-backed.
*
* @param node The node to be added.
*/
- (void)addSubnode:(ASDisplayNode *)node;
@end
/** CALayer(AsyncDisplayKit) defines convenience method for adding sub-ASDisplayNode to a CALayer. */
@interface CALayer (AsyncDisplayKit)
/**
* Convenience method, equivalent to [layer addSublayer:node.layer].
*
* @param node The node to be added.
*/
- (void)addSubnode:(ASDisplayNode *)node;
@end

View File

@@ -19,6 +19,8 @@
#import "ASDisplayNodeExtras.h"
#import "ASInternalHelpers.h"
#import "ASLayout.h"
#import "ASLayoutSpec.h"
@interface ASDisplayNode () <UIGestureRecognizerDelegate>
@@ -1307,10 +1309,10 @@ static NSInteger incrementIfFound(NSInteger i) {
return CGSizeZero;
}
- (id<ASLayoutable>)layoutSpecThatFits:(ASSizeRange)constrainedSize
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASDisplayNodeAssertThreadAffinity(self);
return nil;
return [ASLayoutSpec new];
}
- (ASLayout *)calculatedLayout

View File

@@ -11,10 +11,10 @@
@protocol ASEditableTextNodeDelegate;
//! @abstract ASEditableTextNode implements a node that supports text editing.
/// @abstract ASEditableTextNode implements a node that supports text editing.
@interface ASEditableTextNode : ASDisplayNode
//! @abstract The text node's delegate, which must conform to the <ASEditableTextNodeDelegate> protocol.
// @abstract The text node's delegate, which must conform to the <ASEditableTextNodeDelegate> protocol.
@property (nonatomic, readwrite, weak) id <ASEditableTextNodeDelegate> delegate;
#pragma mark - Configuration
@@ -74,6 +74,11 @@
@end
#pragma mark -
/**
* The methods declared by the ASEditableTextNodeDelegate protocol allow the adopting delegate to
* respond to notifications such as began and finished editing, selection changed and text updated;
* and manage whether a specified text should be replaced.
*/
@protocol ASEditableTextNodeDelegate <NSObject>
@optional

View File

@@ -102,6 +102,10 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) {
#pragma mark -
/**
* The methods declared by the ASMultiplexImageNodeDelegate protocol allow the adopting delegate to respond to
* notifications such as began, progressed and finished downloading, updated and displayed an image.
*/
@protocol ASMultiplexImageNodeDelegate <NSObject>
@optional
@@ -170,6 +174,10 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier
#pragma mark -
/**
* The ASMultiplexImageNodeDataSource protocol is adopted by an object that provides the multiplex image node,
* for each image identifier, an image or a URL the image node should load.
*/
@protocol ASMultiplexImageNodeDataSource <NSObject>
@optional

View File

@@ -139,6 +139,13 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
*/
- (void)_downloadImageWithIdentifier:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image, NSError *error))completionBlock;
/**
@abstract Returns a Boolean value indicating whether the downloaded image should be removed when clearing fetched data
@discussion Downloaded image data should only be cleared out if a cache is present
@return YES if an image cache is available; otherwise, NO.
*/
- (BOOL)_shouldClearFetchedImageData;
@end
@implementation ASMultiplexImageNode
@@ -173,11 +180,15 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
}
}
- (void)displayWillStart
- (void)clearFetchedData
{
[super displayWillStart];
[self fetchData];
[super clearFetchedData];
if ([self _shouldClearFetchedImageData]) {
// setting this to nil makes the node fetch images the next time its display starts
_loadedImageIdentifier = nil;
self.image = nil;
}
}
- (void)fetchData
@@ -626,4 +637,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
[self _loadNextImage];
}
- (BOOL)_shouldClearFetchedImageData {
return _cache != nil;
}
@end

View File

@@ -61,6 +61,8 @@
/**
* Download and display a new image.
*
* @param URL The URL of a new image to download and display.
*
* @param reset Whether to display a placeholder (<defaultImage>) while loading the new image.
*/
- (void)setURL:(NSURL *)URL resetToDefault:(BOOL)reset;
@@ -74,6 +76,10 @@
#pragma mark -
/**
* The methods declared by the ASNetworkImageNodeDelegate protocol allow the adopting delegate to respond to
* notifications such as fininished decoding and downloading an image.
*/
@protocol ASNetworkImageNodeDelegate <NSObject>
/**

View File

@@ -51,7 +51,14 @@
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType;
/**
* initializer.
* Initializer.
*
* @param frame A rectangle specifying the initial location and size of the table view in its superview€™s coordinates.
* The frame of the table view changes as table cells are added and deleted.
*
* @param style A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants.
*
* @param asyncDataFetchingEnabled Enable the data fetching in async mode.
*
* @discussion If asyncDataFetching is enabled, the `ASTableView` will fetch data through `tableView:numberOfRowsInSection:` and
* `tableView:nodeForRowAtIndexPath:` in async mode from background thread. Otherwise, the methods will be invoked synchronically
@@ -96,25 +103,107 @@
- (void)endUpdates;
/**
* Section updating.
* Inserts one or more sections, with an option to animate the insertion.
*
* All operations are asynchronous and thread safe. You can call it from background thread (it is recommendated) and the UI collection
* view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes before these methods are called.
* @param sections An index set that specifies the sections to insert.
*
* @param animation A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
/**
* Deletes one or more sections, with an option to animate the deletion.
*
* @param sections An index set that specifies the sections to delete.
*
* @param animation A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
/**
* Reloads the specified sections using a given animation effect.
*
* @param sections An index set that specifies the sections to reload.
*
* @param animation A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
/**
* Moves a section to a new location.
*
* @param section The index of the section to move.
*
* @param newSection The index that is the destination of the move for the section.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection;
/**
* Row updating.
* Inserts rows at the locations identified by an array of index paths, with an option to animate the insertion.
*
* All operations are asynchronous and thread safe. You can call it from background thread (it is recommendated) and the UI collection
* view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes before these methods are called.
* @param indexPaths An array of NSIndexPath objects, each representing a row index and section index that together identify a row.
*
* @param animation A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
/**
* Deletes the rows specified by an array of index paths, with an option to animate the deletion.
*
* @param indexPaths An array of NSIndexPath objects identifying the rows to delete.
*
* @param animation A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
/**
* Reloads the specified rows using a given animation effect.
*
* @param indexPaths An array of NSIndexPath objects identifying the rows to reload.
*
* @param animation A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
/**
* Moves the row at a specified location to a destination location.
*
* @param indexPath The index path identifying the row to move.
*
* @param newIndexPath The index path that is the destination of the move for the row.
*
* @discussion This operation is asynchronous and thread safe. You can call it from background thread (it is recommendated)
* and the UI table view will be updated asynchronously. The asyncDataSource must be updated to reflect the changes
* before this method is called.
*/
- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath;
/**

View File

@@ -35,5 +35,5 @@
#import <AsyncDisplayKit/ASOverlayLayoutSpec.h>
#import <AsyncDisplayKit/ASRatioLayoutSpec.h>
#import <AsyncDisplayKit/ASStaticLayoutSpec.h>
#import <AsyncDisplayKit/ASStackLayoutChild.h>
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
#import <AsyncDisplayKit/ASStackLayoutSpec.h>

View File

@@ -111,7 +111,7 @@ typedef NSUInteger ASDataControllerAnimationOptions;
@property (nonatomic, weak) id<ASDataControllerDelegate> delegate;
/**
* Designated iniailizer.
* Designated initializer.
*
* @param asyncDataFetchingEnabled Enable the data fetching in async mode.
*

View File

@@ -30,6 +30,8 @@
* Notify the range controller that the visible range has been updated.
* This is the primary input call that drives updating the working ranges, and triggering their actions.
*
* @param scrollDirection The current scroll direction of the scroll view.
*
* @see [ASRangeControllerDelegate rangeControllerVisibleNodeIndexPaths:]
*/
- (void)visibleNodeIndexPathsDidChangeWithScrollDirection:(ASScrollDirection)scrollDirection;
@@ -74,36 +76,70 @@
/**
* Begin updates.
*
* @param rangeController Sender.
*/
- (void)rangeControllerBeginUpdates:(ASRangeController *)rangeController;
/**
* End updates.
*
* @param rangeController Sender.
*
* @param completion Completion block.
*/
- (void)rangeControllerEndUpdates:(ASRangeController * )rangeController completion:(void (^)(BOOL))completion ;
/**
* Fetch nodes at specific index paths.
*
* @param rangeController Sender.
*
* @param indexPaths Index paths.
*/
- (NSArray *)rangeController:(ASRangeController *)rangeController nodesAtIndexPaths:(NSArray *)indexPaths;
/**
* Called for nodes insertion.
*
* @param rangeController Sender.
*
* @param indexPaths Index path of inserted nodes.
*
* @param animationOptions Animation options. See ASDataControllerAnimationOptions.
*/
- (void)rangeController:(ASRangeController *)rangeController didInsertNodesAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions;
/**
* Called for nodes deletion.
*
* @param rangeController Sender.
*
* @param indexPaths Index path of deleted nodes.
*
* @param animationOptions Animation options. See ASDataControllerAnimationOptions.
*/
- (void)rangeController:(ASRangeController *)rangeController didDeleteNodesAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions;
/**
* Called for section insertion.
*
* @param rangeController Sender.
*
* @param indexSet Index set of inserted sections.
*
* @param animationOptions Animation options. See ASDataControllerAnimationOptions.
*/
- (void)rangeController:(ASRangeController *)rangeController didInsertSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions;
/**
* Called for section deletion.
*
* @param rangeController Sender.
*
* @param indexSet Index set of deleted sections.
*
* @param animationOptions Animation options. See ASDataControllerAnimationOptions.
*/
- (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions;

View File

@@ -12,6 +12,7 @@
#import "ASAssert.h"
#import "ASBaseDefines.h"
#import "ASLayout.h"
@interface ASBackgroundLayoutSpec ()
{

View File

@@ -10,6 +10,7 @@
#import <AsyncDisplayKit/ASLayoutSpec.h>
/** How the child is centered within the spec. */
typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecCenteringOptions) {
/** The child is positioned in {0,0} relatively to the layout bounds */
ASCenterLayoutSpecCenteringNone = 0,
@@ -21,6 +22,7 @@ typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecCenteringOptions) {
ASCenterLayoutSpecCenteringXY = ASCenterLayoutSpecCenteringX | ASCenterLayoutSpecCenteringY
};
/** How much space the spec will take up. */
typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
/** The spec will take up the maximum size possible */
ASCenterLayoutSpecSizingOptionDefault,
@@ -36,8 +38,13 @@ typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
@interface ASCenterLayoutSpec : ASLayoutSpec
/**
@param centeringOptions, see ASCenterLayoutSpecCenteringOptions.
@param child The child to center.
* Initializer.
*
* @param centeringOptions How the child is centered.
*
* @param sizingOptions How much space will be taken up.
*
* @param child The child to center.
*/
+ (instancetype)newWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions
sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions

View File

@@ -11,6 +11,7 @@
#import "ASCenterLayoutSpec.h"
#import "ASInternalHelpers.h"
#import "ASLayout.h"
@implementation ASCenterLayoutSpec
{

View File

@@ -13,14 +13,11 @@
/**
A dimension relative to constraints to be provided in the future.
A RelativeDimension can be one of two types:
"Points" - Just a number. It will always resolve to exactly this amount. This is the default type.
"Percent" - Multiplied to a provided parent amount to resolve a final amount.
*/
typedef NS_ENUM(NSInteger, ASRelativeDimensionType) {
/** Just a number. It will always resolve to exactly this amount. This is the default type. */
ASRelativeDimensionTypePoints,
/** Multiplied to a provided parent amount to resolve a final amount. */
ASRelativeDimensionTypePercent,
};

View File

@@ -14,6 +14,7 @@
#import "ASBaseDefines.h"
#import "ASInternalHelpers.h"
#import "ASLayout.h"
@interface ASInsetLayoutSpec ()
{

View File

@@ -32,20 +32,46 @@ extern BOOL CGPointIsNull(CGPoint point);
*/
@property (nonatomic, readonly) NSArray *sublayouts;
/**
* Initializer.
*
* @param layoutableObject The backing ASLayoutable object.
*
* @param size The size of this layout.
*
* @param position The posiion of this layout within its parent (if available).
*
* @param sublayouts Sublayouts belong to the new layout.
*/
+ (instancetype)newWithLayoutableObject:(id<ASLayoutable>)layoutableObject
size:(CGSize)size
position:(CGPoint)position
sublayouts:(NSArray *)sublayouts;
/**
* Convenience that has CGPointNull position.
* Convenience initializer that has CGPointNull position.
* Best used by ASDisplayNode subclasses that are manually creating a layout for -calculateLayoutThatFits:,
* or for ASLayoutSpec subclasses that are referencing the "self" level in the layout tree,
* or for creating a sublayout of which the position is yet to be determined.
*
* @param layoutableObject The backing ASLayoutable object.
*
* @param size The size of this layout.
*
* @param sublayouts Sublayouts belong to the new layout.
*/
+ (instancetype)newWithLayoutableObject:(id<ASLayoutable>)layoutableObject
size:(CGSize)size
sublayouts:(NSArray *)sublayouts;
/**
* Convenience that has CGPointNull position and no sublayouts.
* Convenience that has CGPointNull position and no sublayouts.
* Best used for creating a layout that has no sublayouts, and is either a root one
* or a sublayout of which the position is yet to be determined.
*
* @param layoutableObject The backing ASLayoutable object.
*
* @param size The size of this layout.
*/
+ (instancetype)newWithLayoutableObject:(id<ASLayoutable>)layoutableObject size:(CGSize)size;

View File

@@ -9,7 +9,6 @@
*/
#import <AsyncDisplayKit/ASLayoutable.h>
#import <AsyncDisplayKit/ASLayout.h>
/** A layout spec is an immutable object that describes a layout, loosely inspired by React. */
@interface ASLayoutSpec : NSObject <ASLayoutable>

View File

@@ -9,10 +9,15 @@
*/
#import <AsyncDisplayKit/ASDimension.h>
#import <AsyncDisplayKit/ASStackLayoutChild.h>
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
@class ASLayout;
/**
* The ASLayoutable protocol declares a method for measuring the layout of an object. A class must implement the method
* so that instances of that class can be used to build layout trees. The protocol also provides information
* about how an object should be laid out within an ASStackLayoutSpec.
*/
@protocol ASLayoutable <NSObject>
/**

View File

@@ -12,6 +12,7 @@
#import "ASAssert.h"
#import "ASBaseDefines.h"
#import "ASLayout.h"
@implementation ASOverlayLayoutSpec
{

View File

@@ -17,6 +17,7 @@
#import "ASBaseDefines.h"
#import "ASInternalHelpers.h"
#import "ASLayout.h"
@implementation ASRatioLayoutSpec
{

View File

@@ -8,7 +8,7 @@
*
*/
#import "ASStaticLayoutSpecDimension.h"
#import "ASRelativeSize.h"
#import "ASAssert.h"
ASRelativeSizeRange const ASRelativeSizeRangeUnconstrained = {};

View File

@@ -15,8 +15,12 @@
typedef NS_ENUM(NSUInteger, ASStackLayoutAlignSelf) {
/** Inherit alignment value from containing stack. */
ASStackLayoutAlignSelfAuto,
/** Align to start of cross axis */
ASStackLayoutAlignSelfStart,
/** Align with end of cross axis */
ASStackLayoutAlignSelfEnd,
/** Center on cross axis */
ASStackLayoutAlignSelfCenter,
/** Expand to fill cross axis */
ASStackLayoutAlignSelfStretch,
};

View File

@@ -10,8 +10,11 @@
#import <AsyncDisplayKit/ASLayoutSpec.h>
/** The direction children are stacked in */
typedef NS_ENUM(NSUInteger, ASStackLayoutDirection) {
/** Children are stacked vertically */
ASStackLayoutDirectionVertical,
/** Children are stacked horizontally */
ASStackLayoutDirectionHorizontal,
};
@@ -34,6 +37,7 @@ typedef NS_ENUM(NSUInteger, ASStackLayoutJustifyContent) {
ASStackLayoutJustifyContentEnd,
};
/** Orientation of children along cross axis */
typedef NS_ENUM(NSUInteger, ASStackLayoutAlignItems) {
/** Align children to start of cross axis */
ASStackLayoutAlignItemsStart,
@@ -68,6 +72,7 @@ typedef struct {
justifyContent determines how children are laid out.
For example:
- Suppose stacking direction is Vertical, min-width=100, max-width=300, min-height=200, max-height=500.
- All children are laid out with min-width=100, max-width=300, min-height=0, max-height=INFINITY.
- If the sum of the childrens' heights is less than 200, children with flexGrow are flexed larger.

View File

@@ -9,8 +9,12 @@
*/
#import <AsyncDisplayKit/ASLayoutSpec.h>
#import <AsyncDisplayKit/ASStaticLayoutSpecDimension.h>
#import <AsyncDisplayKit/ASRelativeSize.h>
/**
* An ASStaticLayoutSpecChild object wraps an ASLayoutable object and provides position and size information,
* to be used as a child of an ASStaticLayoutSpec.
*/
@interface ASStaticLayoutSpecChild : NSObject
@property (nonatomic, readonly) CGPoint position;
@@ -21,20 +25,33 @@
*/
@property (nonatomic, readonly) ASRelativeSizeRange size;
/**
* Initializer.
*
* @param position The position of this child within its parent spec.
*
* @param layoutableObject The backing ASLayoutable object of this child.
*
* @param size The size range that this child's size is trstricted according to.
*/
+ (instancetype)newWithPosition:(CGPoint)position layoutableObject:(id<ASLayoutable>)layoutableObject size:(ASRelativeSizeRange)size;
/**
Convenience with default size is Unconstrained in both dimensions, which sets the child's min size to zero
and max size to the maximum available space it can consume without overflowing the spec's bounds.
* Convenience initializer with default size is Unconstrained in both dimensions, which sets the child's min size to zero
* and max size to the maximum available space it can consume without overflowing the spec's bounds.
*
* @param position The position of this child within its parent spec.
*
* @param layoutableObject The backing ASLayoutable object of this child.
*/
+ (instancetype)newWithPosition:(CGPoint)position layoutableObject:(id<ASLayoutable>)layoutableObject;
@end
/*
A layout spec that positions children at fixed positions.
Computes a size that is the union of all childrens' frames.
/**
* A layout spec that positions children at fixed positions.
*
* Computes a size that is the union of all childrens' frames.
*/
@interface ASStaticLayoutSpec : ASLayoutSpec

View File

@@ -12,6 +12,7 @@
#import "ASLayoutSpecUtilities.h"
#import "ASInternalHelpers.h"
#import "ASLayout.h"
@implementation ASStaticLayoutSpecChild

View File

@@ -17,7 +17,6 @@
#import "ASDisplayNode.h"
#import "ASSentinel.h"
#import "ASThread.h"
#import "ASLayout.h"
BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector);
void ASDisplayNodePerformBlockOnMainThread(void (^block)());

View File

@@ -8,11 +8,9 @@
*
*/
#import <UIKit/UIKit.h>
#include <CoreGraphics/CGBase.h>
#import "ASBaseDefines.h"
@class ASLayoutChild;
ASDISPLAYNODE_EXTERN_C_BEGIN
BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector);

View File

@@ -12,6 +12,7 @@
#import "ASDisplayNode.h"
#import "ASLayoutSpec.h"
#import "ASLayout.h"
@interface ASTestNode : ASDisplayNode
- (void)setLayoutSpecUnderTest:(ASLayoutSpec *)layoutSpecUnderTest sizeRange:(ASSizeRange)sizeRange;

View File

@@ -1,7 +1,7 @@
#!/bin/sh
set -e
HEADERS=`ls ../AsyncDisplayKit/*.h ../AsyncDisplayKit/Details/ASRangeController.h`
HEADERS=`ls ../AsyncDisplayKit/*.h ../AsyncDisplayKit/Details/ASRangeController.h ../AsyncDisplayKit/Layout/*.h`
rm -rf htdocs appledoc

View File

@@ -74,7 +74,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName";
}
#if UseAutomaticLayout
- (id<ASLayoutable>)layoutSpecThatFits:(ASSizeRange)constrainedSize
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
return
[ASInsetLayoutSpec

View File

@@ -129,7 +129,7 @@ static const CGFloat kInnerPadding = 10.0f;
}
#if UseAutomaticLayout
- (id<ASLayoutable>)layoutSpecThatFits:(ASSizeRange)constrainedSize
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
ASRatioLayoutSpec *imagePlaceholder = [ASRatioLayoutSpec newWithRatio:1.0 child:_imageNode];
imagePlaceholder.flexBasis = ASRelativeDimensionMakeWithPoints(kImageSize);