Implement getter methods for new table / collection delegate / dataSource. Make ASTableView node-backed.

This commit is contained in:
Scott Goodson
2015-12-24 18:02:52 -08:00
parent 27c151095b
commit c1640c7f59
3 changed files with 53 additions and 12 deletions

View File

@@ -8,6 +8,7 @@
#import "ASTableView.h"
#import "ASTableViewInternal.h"
#import "ASTableNode.h"
#import "ASAssert.h"
#import "ASBatchFetching.h"
@@ -159,33 +160,33 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
return [self initWithFrame:frame style:style asyncDataFetching:NO];
}
// FIXME: This method is deprecated and will probably be removed in or shortly after 2.0.
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncDataFetching:(BOOL)asyncDataFetchingEnabled
{
return [self initWithFrame:frame style:style dataControllerClass:[self.class dataControllerClass] asyncDataFetching:asyncDataFetchingEnabled];
}
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass asyncDataFetching:(BOOL)asyncDataFetchingEnabled
{
ASTableNode *tableNode = [[ASTableNode alloc] initWithStyle:style];
tableNode.frame = frame;
return tableNode.view;
}
- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
if (!(self = [super initWithFrame:frame style:style]))
return nil;
// FIXME: asyncDataFetching is currently unreliable for some use cases.
// https://github.com/facebook/AsyncDisplayKit/issues/385
asyncDataFetchingEnabled = NO;
[self configureWithDataControllerClass:dataControllerClass asyncDataFetching:asyncDataFetchingEnabled];
[self configureWithDataControllerClass:[self.class dataControllerClass] asyncDataFetching:NO];
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
if (!(self = [super initWithCoder:aDecoder]))
return nil;
[self configureWithDataControllerClass:[self.class dataControllerClass] asyncDataFetching:NO];
return self;
NSLog(@"Warning: AsyncDisplayKit is not designed to be used with Interface Builder. Table properties set in IB will be lost.");
return [self initWithFrame:CGRectZero style:UITableViewStylePlain];
}
- (void)dealloc