Mehod -numberOfSectionsInTableView: is optional but not conditionally checked

The documentation for `UITableViewDataSource` specifies that the default value is 1, and that its implementation is optional. However, ASTableView's forwarding doesn't account for the unimplemented case. The desired behavior is to return 1 in the case that the method is not implemented.
This commit is contained in:
Andrew Toulouse
2014-09-22 21:10:51 -07:00
parent 7dd94a6102
commit 3aa6fc0d38

View File

@@ -317,7 +317,11 @@ static BOOL _isInterceptedSelector(SEL sel)
- (NSInteger)rangeControllerSections:(ASRangeController *)rangeController
{
ASDisplayNodeAssertMainThread();
return [_asyncDataSource numberOfSectionsInTableView:self];
if ([_asyncDataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]) {
return [_asyncDataSource numberOfSectionsInTableView:self];
} else {
return 1;
}
}
- (NSInteger)rangeController:(ASRangeController *)rangeController rowsInSection:(NSInteger)section