Remove cell param from cellMapping heightOfCellForObjectAtIndexPath block, to avoid issues with and infinite loop. Change a few form methods to comply with tableController nomenclature. Fix broken specs and issues with tableController naming conventions in UI specs.

This commit is contained in:
Jeff Arena
2011-12-21 18:31:30 -05:00
committed by Blake Watters
parent 1617dd3ac4
commit 8ec9ac811e
8 changed files with 65 additions and 56 deletions

View File

@@ -515,9 +515,8 @@ static NSString* lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
RKTableViewCellMapping* cellMapping = [self cellMappingForObjectAtIndexPath:indexPath];
if (cellMapping.heightOfCellForObjectAtIndexPath) {
UITableViewCell* cell = [self tableView:self.tableView cellForRowAtIndexPath:indexPath];
id object = [self objectForRowAtIndexPath:indexPath];
CGFloat height = cellMapping.heightOfCellForObjectAtIndexPath(cell, object, indexPath);
CGFloat height = cellMapping.heightOfCellForObjectAtIndexPath(object, indexPath);
RKLogTrace(@"Variable row height configured for tableView. Height via block invocation for row at indexPath '%@' = %f", indexPath, cellMapping.rowHeight);
return height;
} else {

View File

@@ -108,8 +108,8 @@ typedef void(^RKFormBlock)();
// TODO: Implement me...
//- (BOOL)validate:(NSArray**)errors;
- (void)willLoadInTableViewModel:(RKTableController *)tableController;
- (void)didLoadInTableViewModel:(RKTableController *)tableController;
- (void)willLoadInTableController:(RKTableController *)tableController;
- (void)didLoadInTableController:(RKTableController *)tableController;
// Sent from the form section
- (void)formSection:(RKFormSection *)formSection didAddTableItem:(RKTableItem *)tableItem forAttributeAtKeyPath:(NSString *)attributeKeyPath;

View File

@@ -249,10 +249,10 @@
#pragma mark - Subclass Hooks
- (void)willLoadInTableViewModel:(RKTableController *)tableController {
- (void)willLoadInTableController:(RKTableController *)tableController {
}
- (void)didLoadInTableViewModel:(RKTableController *)tableController {
- (void)didLoadInTableController:(RKTableController *)tableController {
_tableController = tableController;
}

View File

@@ -255,7 +255,7 @@
// The form replaces the content in the table
[self removeAllSections:NO];
[form willLoadInTableViewModel:self];
[form willLoadInTableController:self];
for (RKFormSection *section in form.sections) {
NSUInteger sectionIndex = [form.sections indexOfObject:section];
section.objects = [self objectsWithHeaderAndFooters:section.objects forSection:sectionIndex];
@@ -269,7 +269,7 @@
// }
[self didFinishLoad];
[form didLoadInTableViewModel:self];
[form didLoadInTableController:self];
}
#pragma mark - UITableViewDataSource methods

View File

@@ -24,7 +24,7 @@
/** @name Cell Mapping Block Callbacks **/
typedef void(^RKTableViewCellForObjectAtIndexPathBlock)(UITableViewCell *cell, id object, NSIndexPath* indexPath);
typedef CGFloat(^RKTableViewHeightOfCellForObjectAtIndexPathBlock)(UITableViewCell *cell, id object, NSIndexPath *indexPath);
typedef CGFloat(^RKTableViewHeightOfCellForObjectAtIndexPathBlock)(id object, NSIndexPath *indexPath);
typedef void(^RKTableViewAccessoryButtonTappedForObjectAtIndexPathBlock)(UITableViewCell *cell, id object, NSIndexPath *indexPath);
typedef NSString*(^RKTableViewTitleForDeleteButtonForObjectAtIndexPathBlock)(UITableViewCell *cell, id object, NSIndexPath *indexPath);
typedef UITableViewCellEditingStyle(^RKTableViewEditingStyleForObjectAtIndexPathBlock)(UITableViewCell *cell, id object, NSIndexPath *indexPath);