Default proxy object for ASTableView and ASCollectionView

fixes #231 #233
This commit is contained in:
Ryan Nystrom
2015-01-20 13:15:39 -08:00
parent 7542f7ca17
commit afb21bf8dd
2 changed files with 13 additions and 21 deletions

View File

@@ -63,7 +63,6 @@ static BOOL _isInterceptedSelector(SEL sel)
return nil;
}
ASDisplayNodeAssert(target, @"target must not be nil");
ASDisplayNodeAssert(interceptor, @"interceptor must not be nil");
_target = target;
@@ -126,6 +125,9 @@ static BOOL _isInterceptedSelector(SEL sel)
_dataController.delegate = _rangeController;
_dataController.dataSource = self;
_proxyDelegate = [[_ASCollectionViewProxy alloc] initWithTarget:nil interceptor:self];
super.delegate = (id<UICollectionViewDelegate>)_proxyDelegate;
[self registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"_ASCollectionViewCell"];
return self;
@@ -174,15 +176,9 @@ static BOOL _isInterceptedSelector(SEL sel)
if (_asyncDelegate == asyncDelegate)
return;
if (asyncDelegate == nil) {
_asyncDelegate = nil;
_proxyDelegate = nil;
super.delegate = nil;
} else {
_asyncDelegate = asyncDelegate;
_proxyDelegate = [[_ASCollectionViewProxy alloc] initWithTarget:_asyncDelegate interceptor:self];
super.delegate = (id<UICollectionViewDelegate>)_proxyDelegate;
}
}
- (ASRangeTuningParameters)rangeTuningParameters

View File

@@ -63,7 +63,6 @@ static BOOL _isInterceptedSelector(SEL sel)
return nil;
}
ASDisplayNodeAssert(target, @"target must not be nil");
ASDisplayNodeAssert(interceptor, @"interceptor must not be nil");
_target = target;
@@ -135,6 +134,9 @@ static BOOL _isInterceptedSelector(SEL sel)
_dataController.dataSource = self;
_dataController.delegate = _rangeController;
_proxyDelegate = [[_ASTableViewProxy alloc] initWithTarget:nil interceptor:self];
super.delegate = (id<UITableViewDelegate>)_proxyDelegate;
return self;
}
@@ -173,15 +175,9 @@ static BOOL _isInterceptedSelector(SEL sel)
if (_asyncDelegate == asyncDelegate)
return;
if (asyncDelegate == nil) {
_asyncDelegate = nil;
_proxyDelegate = nil;
super.delegate = nil;
} else {
_asyncDelegate = asyncDelegate;
_proxyDelegate = [[_ASTableViewProxy alloc] initWithTarget:_asyncDelegate interceptor:self];
_proxyDelegate = [[_ASTableViewProxy alloc] initWithTarget:asyncDelegate interceptor:self];
super.delegate = (id<UITableViewDelegate>)_proxyDelegate;
}
}
- (void)reloadData