|
21 | 21 | #import "ASLayoutController.h" |
22 | 22 | #import "ASRangeController.h" |
23 | 23 |
|
| 24 | +#import <CoreFoundation/CoreFoundation.h> |
| 25 | + |
24 | 26 | static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; |
25 | 27 |
|
26 | 28 | //#define LOG(...) NSLog(__VA_ARGS__) |
@@ -80,6 +82,10 @@ - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated |
80 | 82 | #pragma mark - |
81 | 83 | #pragma mark ASTableView |
82 | 84 |
|
| 85 | +@interface ASTableNode () |
| 86 | +- (instancetype)_initWithStyle:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass; |
| 87 | +@end |
| 88 | + |
83 | 89 | @interface ASTableView () <ASRangeControllerDataSource, ASRangeControllerDelegate, ASDataControllerSource, _ASTableViewCellDelegate, ASCellNodeLayoutDelegate, ASDelegateProxyInterceptor> { |
84 | 90 | ASTableViewProxy *_proxyDataSource; |
85 | 91 | ASTableViewProxy *_proxyDelegate; |
@@ -168,17 +174,21 @@ - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncD |
168 | 174 |
|
169 | 175 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass asyncDataFetching:(BOOL)asyncDataFetchingEnabled |
170 | 176 | { |
171 | | - ASTableNode *tableNode = [[ASTableNode alloc] initWithStyle:style]; |
172 | | - tableNode.frame = frame; |
173 | | - return tableNode.view; |
| 177 | +// ASTableNode *tableNode = [[ASTableNode alloc] _initWithStyle:style dataControllerClass:dataControllerClass]; |
| 178 | +// tableNode.frame = frame; |
| 179 | +// return tableNode.view; |
| 180 | + return [self _initWithFrame:frame style:style dataControllerClass:dataControllerClass]; |
174 | 181 | } |
175 | 182 |
|
176 | | -- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style |
| 183 | +- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass |
177 | 184 | { |
178 | 185 | if (!(self = [super initWithFrame:frame style:style])) |
179 | 186 | return nil; |
180 | 187 |
|
181 | | - [self configureWithDataControllerClass:[self.class dataControllerClass] asyncDataFetching:NO]; |
| 188 | + if (!dataControllerClass) { |
| 189 | + dataControllerClass = [self.class dataControllerClass]; |
| 190 | + } |
| 191 | + [self configureWithDataControllerClass:dataControllerClass asyncDataFetching:NO]; |
182 | 192 |
|
183 | 193 | return self; |
184 | 194 | } |
|
0 commit comments