mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Add table controller level block callbacks. refs #796
This commit is contained in:
@@ -80,6 +80,10 @@ static NSString *lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
@synthesize autoResizesForKeyboard = _autoResizesForKeyboard;
|
||||
@synthesize emptyItem = _emptyItem;
|
||||
|
||||
@synthesize onSelectCellForObjectAtIndexPath = _onSelectCellForObjectAtIndexPath;
|
||||
@synthesize onPrepareCellForObjectAtIndexPath = _onPrepareCellForObjectAtIndexPath;
|
||||
@synthesize onWillDisplayCellForObjectAtIndexPath = _onWillDisplayCellForObjectAtIndexPath;
|
||||
|
||||
@synthesize cellSwipeViewsEnabled = _cellSwipeViewsEnabled;
|
||||
@synthesize cellSwipeView = _cellSwipeView;
|
||||
@synthesize swipeCell = _swipeCell;
|
||||
@@ -188,6 +192,11 @@ static NSString *lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
[_objectLoader release];
|
||||
_objectLoader = nil;
|
||||
|
||||
// Blocks
|
||||
[_onSelectCellForObjectAtIndexPath release];
|
||||
[_onPrepareCellForObjectAtIndexPath release];
|
||||
[_onWillDisplayCellForObjectAtIndexPath release];
|
||||
|
||||
[_cellMappings release];
|
||||
[_headerItems release];
|
||||
[_footerItems release];
|
||||
@@ -463,6 +472,11 @@ static NSString *lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
NSAssert(theTableView == self.tableView, @"tableView:cellForRowAtIndexPath: invoked with inappropriate tableView: %@", theTableView);
|
||||
UITableViewCell *cell = [self cellForObjectAtIndexPath:indexPath];
|
||||
|
||||
if (self.onPrepareCellForObjectAtIndexPath) {
|
||||
id object = [self objectForRowAtIndexPath:indexPath];
|
||||
self.onPrepareCellForObjectAtIndexPath(cell, object, indexPath);
|
||||
}
|
||||
|
||||
RKLogTrace(@"%@ cellForRowAtIndexPath:%@ = %@", self, indexPath, cell);
|
||||
return cell;
|
||||
}
|
||||
@@ -501,6 +515,11 @@ static NSString *lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
cellMapping.onSelectCellForObjectAtIndexPath(cell, object, indexPath);
|
||||
}
|
||||
|
||||
// Table level selection callbacks
|
||||
if (self.onSelectCellForObjectAtIndexPath) {
|
||||
self.onSelectCellForObjectAtIndexPath(cell, object, indexPath);
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(tableController:didSelectCell:forObject:atIndexPath:)]) {
|
||||
[self.delegate tableController:self didSelectCell:cell forObject:object atIndexPath:indexPath];
|
||||
}
|
||||
@@ -516,6 +535,10 @@ static NSString *lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
cellMapping.onCellWillAppearForObjectAtIndexPath(cell, mappableObject, indexPath);
|
||||
}
|
||||
|
||||
if (self.onWillDisplayCellForObjectAtIndexPath) {
|
||||
self.onWillDisplayCellForObjectAtIndexPath(cell, mappableObject, indexPath);
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(tableController:willDisplayCell:forObject:atIndexPath:)]) {
|
||||
[self.delegate tableController:self willDisplayCell:cell forObject:mappableObject atIndexPath:indexPath];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user