[ASRangeController] Initial implementation of functional-style, ASInterfaceState-based range controller.

This commit is contained in:
Scott Goodson
2016-01-01 00:48:44 -08:00
parent 7a9cd1f930
commit b273f358f5
26 changed files with 382 additions and 187 deletions

View File

@@ -13,10 +13,15 @@
#import "ViewController.h"
#import <AsyncDisplayKit/ASDisplayNode.h>
#import <AsyncDisplayKit/ASDisplayNode+Beta.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[ASDisplayNode setShouldUseNewRenderingRange:YES];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]];

View File

@@ -51,7 +51,7 @@
ASRangeTuningParameters rangeTuningParameters;
rangeTuningParameters.leadingBufferScreenfuls = 1.0;
rangeTuningParameters.trailingBufferScreenfuls = 0.5;
[_tableNode.view setTuningParameters:rangeTuningParameters forRangeType:ASLayoutRangeTypeRender];
[_tableNode.view setTuningParameters:rangeTuningParameters forRangeType:ASLayoutRangeTypeDisplay];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

View File

@@ -9,6 +9,9 @@
#import <AsyncDisplayKit/AsyncDisplayKit.h>
@interface RandomCoreGraphicsNode : ASCellNode
{
ASTextNode *_indexPathTextNode;
}
@property (nonatomic) NSIndexPath *indexPath;

View File

@@ -42,6 +42,37 @@
CGColorSpaceRelease(colorSpace);
}
- (instancetype)init
{
if (!(self = [super init])) {
return nil;
}
_indexPathTextNode = [[ASTextNode alloc] init];
[self addSubnode:_indexPathTextNode];
return self;
}
- (void)setIndexPath:(NSIndexPath *)indexPath
{
_indexPath = indexPath;
_indexPathTextNode.attributedString = [[NSAttributedString alloc] initWithString:[indexPath description] attributes:nil];
}
//- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
//{
// ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[_indexPathTextNode]];
// stackSpec.flexGrow = YES;
// return stackSpec;
//}
- (void)layout
{
_indexPathTextNode.frame = self.bounds;
[super layout];
}
#if 0
- (void)fetchData
{