mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-01-12 22:51:50 +08:00
Added support for configuring class -> table cell mappings using objectClassName instead of Class object
This commit is contained in:
@@ -101,6 +101,7 @@ extern NSString* const RKTableControllerDidBecomeOffline;
|
||||
@property (nonatomic, retain) RKTableViewCellMappings* cellMappings;
|
||||
|
||||
- (void)mapObjectsWithClass:(Class)objectClass toTableCellsWithMapping:(RKTableViewCellMapping*)cellMapping;
|
||||
- (void)mapObjectsWithClassName:(NSString *)objectClassName toTableCellsWithMapping:(RKTableViewCellMapping*)cellMapping;
|
||||
- (id)objectForRowAtIndexPath:(NSIndexPath *)indexPath;
|
||||
- (RKTableViewCellMapping*)cellMappingForObjectAtIndexPath:(NSIndexPath *)indexPath;
|
||||
|
||||
|
||||
@@ -401,6 +401,10 @@ static NSString* lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
[_cellMappings setCellMapping:cellMapping forClass:objectClass];
|
||||
}
|
||||
|
||||
- (void)mapObjectsWithClassName:(NSString *)objectClassName toTableCellsWithMapping:(RKTableViewCellMapping*)cellMapping {
|
||||
[self mapObjectsWithClass:NSClassFromString(objectClassName) toTableCellsWithMapping:cellMapping];
|
||||
}
|
||||
|
||||
- (id)objectForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
NSAssert(indexPath, @"Cannot lookup object with a nil indexPath");
|
||||
RKTableSection* section = [self sectionAtIndex:indexPath.section];
|
||||
@@ -418,8 +422,6 @@ static NSString* lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
return indexPath ? [self cellForObjectAtIndexPath:indexPath] : nil;
|
||||
}
|
||||
|
||||
// TODO: unit test...
|
||||
// TODO: This needs to be updated to take into account header & footer rows...
|
||||
- (NSIndexPath *)indexPathForObject:(id)object {
|
||||
NSUInteger sectionIndex = 0;
|
||||
for (RKTableSection *section in self.sections) {
|
||||
|
||||
Reference in New Issue
Block a user